[英]PHP File Upload not updaing database or uploading file
我一直在撞牆,試圖找出這個問題,我想做的是
這是我的情況:
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;
如果有人能指出我正確的方向,那就太好了!!!
您可以通過以下方式編輯代碼:
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.