$_files= Array ("Image/jpg", "Image/jpeg", "Image/png", "Image/pjpeg", "Image/gif", "Image/bmp", "image/x-png");
if (Is_array ($_files))
{
if (!in_array ($_files[' userfile ' [' type '],$_files))
{
echo "<script>alert (' picture type does not match, please re-upload '); History.back ();</script>";
Exit
}
}
if ($_files[' userfile ' [' Error ']>0) {
Switch ($_files[' userfile ' [' Error ']) {
Case 1:_alert_back ("Upload the file over the agreed value");
Break
Case 2:_alert_back ("Upload the file over the agreed value");
Break
Case 3:_alert_back ("partial file Upload");
Break
Case 4:_alert_back ("No file Upload");
Break
}
Exit
}
Determine the configuration size
if ($_files[' userfile ' [' Size ']>2097152) {
_alert_back ("over 10000");
}
if (Is_uploaded_file ($_files[' userfile ' [' tmp_name ']))
{
if ([email protected]_uploaded_file ($_files[' userfile '] [' tmp_name '], ' photo\1492310565\\ '. $_files[' userfile '] [' Name ']))
{
_alert_back ("Move Failed");
}
else{
_alert_back ("Upload file Success");
}
}else{
_alert_back ("Upload file does not exist");
}
PHP Upload Images