TeddyKiller Posted March 21, 2010 Share Posted March 21, 2010 This is basic stuff, however I'm new to file uploads. Can someone explain it out? if ((($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { 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 />"; 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"; } Link to comment https://forums.phpfreaks.com/topic/195968-can-someone-explain-this-file-upload-script/ Share on other sites More sharing options...
litebearer Posted March 21, 2010 Share Posted March 21, 2010 The script: checks to see if it is a jpg image AND is less than 20K in size; if an error is generated display the error. If no error display the various file information. check to see if same file name aready exists - if so display message; if not, finish uploading the file and display the info Link to comment https://forums.phpfreaks.com/topic/195968-can-someone-explain-this-file-upload-script/#findComment-1029367 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.