kagronick Posted February 11, 2009 Share Posted February 11, 2009 I've been struggling all day trying to get this to work. PHP and Apache are installed and running. I've been trying to get some very simple code to work. Heres the html: <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> Heres the php: <?php $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> In php.ini upload_max_filesize is set to 32M I tried adding LimitRequestBody 0 in httpd.conf. Apache wouldn't start up. So I think its something in Apache Quote Link to comment https://forums.phpfreaks.com/topic/144729-cant-get-files-over-1mb-to-upload-please-help/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 11, 2009 Share Posted February 11, 2009 Your code has zero error checking in it to get it to tell you why it is failing. At a minimum put the following diagnostic code in to see what the ['error'] element is telling you - echo "<pre>"; print_r($_FILES); echo "</pre>"; And also read this - http://us3.php.net/manual/en/features.file-upload.errors.php And the following in your form will limit the size to 100,000 - <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Quote Link to comment https://forums.phpfreaks.com/topic/144729-cant-get-files-over-1mb-to-upload-please-help/#findComment-759469 Share on other sites More sharing options...
kagronick Posted February 11, 2009 Author Share Posted February 11, 2009 Thanks a lot. That got it working. Is there an error code like that for the mail() function. I can't get it to work on the local machine. Is there a way to login to the account with the mail server. I'm using hMailServer. Quote Link to comment https://forums.phpfreaks.com/topic/144729-cant-get-files-over-1mb-to-upload-please-help/#findComment-760007 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.