2

For some reason file upload is not working for this .ppt file that I am trying to upload. I have tested it with another ppt file (approximately 250kb) and it worked fine... but this one is 10mb and the $_FILE array is empty when I echo it. Can you guys tell me what I am doing wrong?? I know my PHP file is right.

index.php:

<form action="http://localhost:80/phpconverter/upload.php" method="post"
        enctype="multipart/form-data" target="upload_target">
    <input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE"
            value="102400000" />
    Choose a file to upload:
    <input id="fileName" name="uploaded_file" type="file" />
    <input type="submit" value="Upload"/>

    <iframe id="upload_target" name="upload_target" src="#"
        style="width:200px;height:500px;border:0px solid #fff;"> </iframe>
</form> 

When checking if the file is empty or not (i.e. empty($_FILES["uploaded_file"]) I see that the file is empty, when I have in fact uploaded a file!!

2 Answers 2

5

Your file is too big and exceeds the PHP file default limit which is 2MB.

You have to increase upload_max_filesize and post_max_size in either php.ini or .htaccess file.

Sign up to request clarification or add additional context in comments.

2 Comments

memory_limit and post_max_size may also come into play here.
create another file and put only one line phpinfo() and see if the your change has been reflected
2

but this one is 10mb and the $_FILE array is empty when I echo it

The default PHP configuration places either a 2MB or 8MB limit on uploaded file sizes.

Please refer to the post_max_size and the upload_max_filesize configuration settings in your php.ini file. post_max_size must be equal to or larger than upload_max_filesize. These settings can not be changed at run-time.

2 Comments

Okay I have increased both post_max_size and upload_max_filesize to 100M and it still doesn't work....
What does a phpinfo() call say the new settings are?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.