当我上传图片文件时
move_upload_file
函数时,目标文件夹中没有文件上传。if(isset($_POST['submit'])){
$file = $_FILES['file'];
$ext = explode('.',$file['name']);
$fileActualExt = strtolower(end($ext));
$allowed = array('jpg','jpeg','png','pdf');
if(in_array($fileActualExt,$allowed)){
if($file['error']===0){
if($file['size']<50000){
$fileNameNew = uniqid('',true).'.'.$fileActualExt;
$fileDestination = '\uploads\\'.$fileNameNew;
move_uploaded_file($file['tpm_name'],$fileDestination);
header('location:index.php?uploadsuccess');
}else{
echo 'size too big';
}
}
}else{
echo 'extension incorrect';
}
}
答案 0 :(得分:0)
这适用于Wamp 3 +。
Go to wamp folder (wamp/ or wamp64/)
Open wampmanager.conf
Find urlAddLocalhost param and set it on: urlAddLocalhost = "on"
不需要调整www文件夹中的index.php。