Php uploads images & lt ;? Php $ uptypes = array ('image/jpg ', 'image/jpeg', 'image/png ', 'image/pjpeg', 'image/GIF ', 'image/bmp ', 'image/x-png'); $ max_file_siz php uploads an image
"; If (! Is_uploaded_file ($ _ FILES ["upfile"] [tmp_name]) // whether a file exists {echo "script" alert ('The image does not exist! '); Script ""; echo "script window. location = 'splashadd. php'; script "; exit;} $ file = $ _ FILES [" upfile "]; if ($ max_file_size <$ file [" size "]) // check the file size {echo "script" alert ('The file is too large! '); Script ""; echo "script" window. location = 'splashadd. php'; script ""; exit;} if (! In_array ($ file ["type"], $ uptypes) // check the file type {$ message = "file type does not match! ". $ File ["type"]; echo "script" alert ('$ message'); script "; echo" script "window. location = 'splashadd. php'; script "; exit;} if (! File_exists ($ destination_folder) {mkdir ($ destination_folder);} $ filename = $ file ["tmp_name"]; $ image_size = getimagesize ($ filename ); $ pinfo = pathinfo ($ file ["name"]); $ ftype = $ pinfo ['extension']; $ destination = $ destination_folder. time (). ". ". $ ftype; if (file_exists ($ destination) & $ overwrite! = True) {echo "script" alert ('file with the same name already exists '); script "; echo" script "window. location = 'splashadd. php'; script "; exit;} if (! Move_uploaded_file ($ filename, $ destination) {echo "script" alert ('moving file error'); script ""; echo "script" window. location = 'splashadd. php'; script "; exit;} $ pinfo = pathinfo ($ destination); $ fname = $ pinfo [basename] ;}?>
?