Georg Leber
Georg Leber

Reputation: 3605

PHP file upload

I have big trouble with file uploads with php. My own tests are successful but my colleague is telling me that he cannot update "larger" (ca. 5mb) files.

Phpinfo says: - max_execution_time 30 - memory_limit 32 Mb - post_max_size 8 Mb - upload_max_filesize 10 Mb

Is it better to use FTP? The problem is that I cannot change these settings at my webhoster.

Upvotes: 0

Views: 789

Answers (4)

Georg Leber
Georg Leber

Reputation: 3605

I have asked support for the settings for max_execution_time and max_input_time and this are set to 120 as maximum. So all uploads taking longer then 2 minutes ending up in an Internal Server Error.

Upvotes: 0

symcbean
symcbean

Reputation: 48357

Why have you no error handling to identify why your colleague cannot upload the file? Is it the execution time? is it the memory limit? Is it the max post size? Is it the upload size?

Have you checked to see what happens when he uploads a file? At what point does it fail?

The PHP post_max_size is irrelevant if the webserver has a smaller setting - have you checked?

There are lots of reasons why an HTTP upload might not work, but if the answer to your question is FTP, then you're asking the wrong question.

C.

Upvotes: 1

badchoosed
badchoosed

Reputation: 71

Your script will not work on production because your max_execution_time is set to 30 seconds. This means that you have just 30 sec to upload your file under your server. If you don't have a T1 Internet connection, you won't be able to upload the file. In your upload script try to run the following:

set_time_limit(0);

This will disable max_execution_time definition, letting any connection speed user upload the file using your script.

more info at http://php.net/manual/en/function.set-time-limit.php

regards.

Upvotes: 1

Quasipickle
Quasipickle

Reputation: 4498

You may be able to change those settings using ini_set()

Upvotes: -1

Related Questions