Handle file upload errors

main
Pk11 2 years ago
parent 37281fb240
commit 89d571d245

@ -114,6 +114,12 @@
}
// Validate and move the uploaded image file, if necessary
if($img['error'] != UPLOAD_ERR_OK && $img['error'] != UPLOAD_ERR_NO_FILE) {
if(!empty($img['tmp_name']))
@unlink($img['tmp_name']);
return 'Invalid image, error ' . $img['error'];
}
if(!empty($img['tmp_name'])) {
if((($img['type'] == 'image/gif') || ($img['type'] == 'image/jpeg') || ($img['type'] == 'image/pjpeg')
|| ($img['type'] == 'image/png') || ($img['type'] == 'image/bmp'))

Loading…
Cancel
Save