[英]PHP File Upload not updaing database or uploading file
I have been banging my head against the wall trying to figure out this issue, what I am trying to do is 我一直在撞墙,试图找出这个问题,我想做的是
Here is my case: 这是我的情况:
case"updatesubmit":
if ($_FILES['image']['error'] === UPLOAD_ERR_OK) {
if (($_FILES["image"]["type"] == "image/jpeg") || ($_FILES["image"]["type"] == "image/pjpeg")){
if ($_FILES["image"]["error"] > 0){
echo $_FILES["image"]["error"];
}else{
move_uploaded_file($_FILES["image"]["tmp_name"],
"../upload/CV_1_" . date("Ymd") . $_FILES["image"]["name"]);
$class->update($id, $text, $image);
echo "<div style='padding-left:50px'><strong>Updated!</strong></div>";
}
}else{
echo "<div style='padding-left:50px'><strong>Invalid Image!</strong></div>";
}
}else{
$class->updateWithoutImage($id, $text);
echo "<div style='padding-left:50px'><strong>Updated!</strong></div>";
}
$array = $class->view();
include("view/CV/view_display.html");
break;
If anyone can point me in the right direction, that would be awesome!!! 如果有人能指出我正确的方向,那就太好了!!!
you could edit your code in this way: 您可以通过以下方式编辑代码:
list($width, $height, $type, $attr) = getimagesize($_FILES['image']['tmp_name']);
if($type!=2){ // SO IS NOT JPG
//ERROR
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.