6

I have used a tutorial to create a PHP script to upload files to a server. It works beautifully for images and small files < 10mb but over that size it fails. I believe that this may be due to a server timeout. The question is, if I am correct in my assumption is there a way to tell the server to wait until the file has uploaded?

Of course there may be another issue I haven't thought of, according to the script I have the large uploads aren't producing an error and the "success" text is displayed!

Any helpful advice would be appreciated :)

6 Answers 6

7

Try this: http://php.net/manual/en/function.set-time-limit.php

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

4 Comments

Wow that was quick! Thanks I'll look at the link
Hope it helps :) Otherwise, feel free to ask!
It turns out that my assumption was incorrect and I now belive that I have an issue with file-size
You can change that in php.ini - If you have access to that, that is.
3

You can set the timeout using set_time_limit($seconds)

If you set $seconds to 0, the server won't time out - but use this very carefully!

1 Comment

Thanks for the quick response, I'll try this as well as read the link above.
2

In PHP there's a function called set_time_limit() which you can use to set how long it'll take before PHP terminates due to running to long. Be careful with it though because setting it to 0 can leave php processing waiting around forever and eat up your server resources.

You can also set this directive in php.ini or from apache .htaccess files.

There is also max_input_time in php.ini

Comments

1

This directives can be useful:

  • upload_max_filesize
  • max_execution_time

This directives can be changed in php.ini or via function ini_set.

Comments

1

make sure your allowed over 10mb for uploads http://php.net/manual/en/features.file-upload.errors.php

then with php

set_time_limit(0);

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

Comments

0

If you're using PHP as an Apache module and previous answers doesn't work, you can look at Apache timeout but it's not advisable.

Comments

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.