Uploadcare users have noticed that after upgrading to iOS 8.0 they cannot upload files from Safari.
Sad but true. The new iOS version has a bug that renders sending files by browsers impossible. When you choose a file in a form on HTML page and try to submit it, no file is sent in the request. The browser indicates that it’s waiting for a response, but in fact the response never comes.
So why is there no response? If no file is submitted the server would respond with an error that a file is required or the file is empty. But there’s no response at all (even HTTP 400 Bad Request) and the connection is closed by timeout. The culprit is the request sent by Safari.
POST /form/ HTTP/1.1 Host: 192.168.5.59:8000 Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryGVP84V9BXQSqpZw2 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Content-Length: 134573 Accept-Language: ru Accept-Encoding: gzip, deflate Connection: keep-alive User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12A365 Safari/600.1.4 ------WebKitFormBoundaryGVP84V9BXQSqpZw2 Content-Disposition: form-data; name="file"; filename="image.jpg" Content-Type: image/jpeg ------WebKitFormBoundaryGVP84V9BXQSqpZw2--
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. The server is waiting for the rest of the 134397 bytes, the browser is waiting for a response as it’s sure that the complete request is sent. But nothing happens and the connection is closed by a timeout.
The bug manifests itself in Safari 8.0 (build 600.1.4) on iOS 8.0 (build 12A365). Fun fact: everything is ok on the iOS Simulator that is bundled with XCode. We could reproduce the bug on hardware we could get our hands on (iPhone 4S, iPhone 5, iPad 3). We sure hope that this will be fixed in a future minor update.
All you need is a form with a file field and a server that can accept uploads. There is an online example.
method="post" enctype="multipart/form-data"> <input type="hidden" name="UPLOADCARE_PUB_KEY"
value="demopublickey"> <input type="file" name="file"> <input type="submit"> </form>
To check that this is indeed an iOS8 bug you have to inspect the HTTP request body. Unfortunately Safari Web Inspector cannot be of help here as it doesn’t show file bodies in the request. You can run a listening TCP-server on the same subnet using netcat utility:
netcat -l 8000
You have to change the form’s “action” attribute so that IP address and port point to your running server (e.g. http://192.168.1.101:8000/). You can fork jsbin and save your own. Then you can open a form in Safari and send any file. If everything is correct you will see the raw HTTP request in netcat’s output.
If the file body is included in payload you’ll see a bunch of “garbage” on your screen.
Apple is aware of the problem, here is the response from WebKit Developer Experience Manager.
@BDoma Just a bug we didn’t find in time to make the release. Will be fixed.— Timothy Hatcher (@xeenon) September 21, 2014
This article was written by Danni Moring, an enthusiastic Uploadcare user from Indonesia. It’s always better to read in the language of origin to get all the nuances that author wants to express. So, if your Indonesian is good, read the original post :) Otherwise see translation below.
Successful startups usually begin with an idea that helps solving a specific problem which has not yet been solved efficiently. It’s important to be focused, otherwise you will end up doing everything and nothing really well. It was true for Uploadcare too. We were focused on a very specific task: image uploads to the CDN and simple crop/resize/transform operations on the uploaded images.
However, no one will tell you what is really expected from your startup better than your clients. Today image uploads is just a segment of our business. Our users found other efficient ways to use Uploadcare, we could not even think about at the beginning.
I would like to highlight two of such success stories: Unidesk and PandaDoc.
As Uploadcare becomes popular, users starting to ask repeated questions about integration and usage. Yet some of the topics are not yet covered in the documentation. Also, reading documentation takes time, and our customers are primarily fast-growing start ups where every minute counts.
So, we decided to be more active on StackOverflow, and create an open knowledge base for our service:
You can use tag [uploadcare] to ask questions and search for answers. We encourage anyone who had experience of customizing the widget or any part of the system:
Please, share your solution with others!
It’s time to start building community. Let’s make our first steps on StackOverflow!
Uploadcare allows users to easily upload files from a growing number of social networks and cloud services. Which raises the obvious question — is it safe? And can others read or even modify user files that are not uploaded to Uploadcare but stored in cloud services? To answer all of these questions, we’d like to explain how Uploadcare works with third-party services.