<?PHP/*File Upload restrictions && save uploaded files in this script, we added restrictions on file uploads. Users can only upload. gif or. jpeg files, the file size must be less than KB: The above example creates a temporary copy of the uploaded file in the server's PHP Temp folder. This temporary copy of the file disappears at the end of the script. To save the uploaded file, we need to copy it to another location:*/ if((($_files["File"] ["Type"]== "Image/gif") | | ($_files["File"] ["Type"]== "Image/jpeg") | | ($_files["File"] ["type"] = = "Image/pjpeg")) && ($_files["File"] ["Size"] < 20000) ) { if($_files["File"] ["Error"]>0) { Echo"Error:".$_files["File"] ["Error"]. " <br/> "; }Else{ //Output Information Echo"Upload:".$_files["File"] ["Name"]. "<br/>"; Echo"Type:".$_files["File"] ["Type"]. "<br/>"; Echo"Size:". ($_files["File"] ["Size"]/1024). "Kb<br/>"; Echo"Temp file:".$_files["File"] ["Tmp_name"]. "<br/>"; //This example saves the file to a new folder named "Upload". if(file_exists("upload/".$_files["File"] ["Name"])) { Echo $_files["File"] ["Name"]. "already exists."; }Else{ Move_uploaded_file($_files["File"] ["Tmp_name"], "upload/".$_files["File"] ["Name"]); Echo"Stored in:". Upload/".$_files["File"] ["Name"]; } } }Else { Echo"Invalid file"; }? ><! DOCTYPE html> for= "File" >Filename:</label> <input type= "file" name= "file" id= "file"/> </p> <p> <input type= "Submit" name= "submit" value= "Submit"/> </p> </form></bod Y>PHP basic 22: Upload and save files