我有上传2张图片的表格
<form enctype="multipart/form-data" action = 'upload_photo.php' method = 'post'>
Upload your profile picture here<input type = "file" name = "dp"/><br>
Upload your about me cover here<input type = "file" name = "cover"/></br>
<button id="upload">Upload Photos</button>
</form>
我有这个php文件来实际将上传的图像移动到所需的目录
if((is_uploaded_file($_FILES["dp"]["tmp_name"])){
move_uploaded_file($_FILES["dp"]["tmp_name"],"dp/dp1.jpg");
}
if((is_uploaded_file($_FILES["cover"]["tmp_name"])){
move_uploaded_file($_FILES["cover"]["tmp_name"],"cover/cover1.jpg");
}
这个代码上周适用于我,但我似乎无法知道为什么它不再起作用了。代码是什么代码?
答案 0 :(得分:0)
尝试使用realpath($_FILES["dp"]["tmp_name"])
。这可能会对您有所帮助。