pagegen Posted August 4, 2010 Share Posted August 4, 2010 Hi guys I am using the code below to upload files, image files seem to upload ok, but for some reason I cnt seem to upload pdf files.. any suggestions? Thank you <?php ini_set('file_uploads','on'); ini_set('upload_max_filesize','1000M'); ini_set('max_execution_time', 0); 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("invoices/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "invoices/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } ?> <form action="" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/209775-pdf-not-uploading/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 4, 2010 Share Posted August 4, 2010 Your code has no error checking/error reporting logic in it to get it to tell you if the upload worked or failed or why it is failing. You must test if $_FILES array contains anything and then you must test the $_FILES["file"]["error"] element before you attempt to access any of the uploaded file information. You are probably exceeding one of the size limits. Ref: http://in2.php.net/manual/en/ini.core.php#ini.post-max-size http://in2.php.net/manual/en/features.file-upload.errors.php Also, you cannot set file_uploads or upload_max_filesize in your script. They must be set before your script executes. Quote Link to comment https://forums.phpfreaks.com/topic/209775-pdf-not-uploading/#findComment-1095050 Share on other sites More sharing options...
pagegen Posted August 4, 2010 Author Share Posted August 4, 2010 cheers mate, was banging my head on this for hours Quote Link to comment https://forums.phpfreaks.com/topic/209775-pdf-not-uploading/#findComment-1095058 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.