-1

I have a php script that facilitates uploading of files (jpgs & movie files).

Php script: http://pastebin.com/sA6Ewciq

However, when using a iphone with safari & chrome, it will successfully upload jpgs while not uploading it's *.MOV format. The server will receive a 0 size of the file, so it connects and creates the file with correct filename, but no data transfer occurs.

This works perfectly fine on Android, Desktops. If I copy the .MOV file that does not work on the iphone and copy to the android it uploads successfully.

This tells me that the php script works right (98% sure) all permissions are correct, but there is something about the MOV format that does not permit copying where JPG's are allowed?

Server version: Apache/2.4.7 (Ubuntu)

2 Answers 2

1

This question appears to have been downvoted several times (I don't know why) despite this being a legitimate issue. Further searching brought up these answers relating to this exact issue, however, it has not been greatly addressed while using php.

https://github.com/FineUploader/fine-uploader/issues/990

Uploading files over HTTP fails on iOS 8.0.0 GM Safari

http://blog.uploadcare.com/post/97884147203/you-cannot-upload-files-to-a-server-using-mobile-safari

It appears the cause is a malfunction with ios requests causing it to fail when the upload script permits multiple file selection as it sends incorrect get requests.

We can see that the request length should be 134573 bytes (Content-Length header), but as the file is absent from the request and the real length is only 176 bytes.

This explains why the file is 0 bytes but doesn't explain why jpgs work. Oh well

This affects ios 7.* and 8.0.0

The "fix" involves either using ios 6, or updating to ios 8.0.2 which fixes it in safari but not in chrome.

0

Videos are larger files then images therefore will require longer time execution.

Because an iPhone has less ressources then a typical PC it will take even longer.

When the maximum time is reached, PHP will just quit leaving half-baked uploads behind.

The solution is to extend the maximum execution time.

You do this in PHP ini

max_execution_time = 60;in second

But you don't have to, you can override it with the following code:

set_time_limit(60);//in second

Don't forget to reboot the server if you make the change in php.ini

2
  • Mine is set at max_execution_time = 180 since it completes the script within a few seconds, I do not see this being the problem. I do not have set_time_limit in my config, since the max time is at 180 already, would this actually benefit?
    – Miati
    Commented Dec 15, 2014 at 1:49
  • @Miati 60 is just an example, you need to put as much time needed use set_time_limit(0) for unlimited just to test if you don't know. set_time_limit is php code in the script
    – meda
    Commented Dec 15, 2014 at 1:50

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.