About resume broken upload with AsiHttpRequest - iphone

I use ASIFormDataRequest to upload my file to Server.
But when the wireless signal is not good enough, Uploading is always failed in the end.
How can I do to resume broken upload? Do AsiHttpRequest support it?
Thanks!

HTTP in general doesn't support resuming uploads.
I think your best approach would be to change the way you upload the file, so that you upload it in chunks.
ie. split the file down into segments of a smaller size (eg. 256 kilobytes) and send each of them in a separate ASIFormDataRequest. Then get your server software to glue them back together.

Related

iPhone downloading many small JSON files and storing in DB asynchronously

I have to download 100 thousand JSONS, each JSON not more than 200 characters. I am using AF networking. Is there a way to encode to reduce the size at the server side and send and i should be able to decode at iPhone side.
Moreover has anyone got a method to download the JSONS and store it in the DB on the background thread.Because when i do that directly the UI thread is blocked. Sample Code would be really helpful.
Need the best way to download the HUGE-JSON and store it in the DB.Thanks!
For encoding you can, for example, use gzip-compressed data in your http response that will be unpacked by ios automatically without the need to code anything. Just add "Content-Encoding: gzip" to your http response on the server side. On iOS, i think NSURLRequest accepts gzip encoding by default, or you can set
[request setValue:#"gzip" forHTTPHeaderField:#"Accept-Encoding"]
Of course you can download the JSONS in the background. A good source for information and example code is here http://iosdevelopmentjournal.com/blog/2013/01/27/running-network-requests-in-the-background/

Limit File Upload Size on client side GWT only

Is there any provision in which i can limit my file upload to some limt ?
I'm using FileUploadField in my GWT screen.
Is there any way i can apply some check that only allows me to upload file max. upto 10MB only ?
TIA !
That is the job of the server. Javascript (and thus abstractions of Javascript such as GWT) are not allowed access to the file being uploaded. The server side should check the file side and throw an exception.
According to http://www.artofsolving.com/node/50 finding the error client side is tricky. You have to actually parse the html results in the iframe used for the upload in the onSubmitComplete event.
As the above answer stated It is not able to be done due to security. It is possible via ActiveX but I am in no way recommending that.
So you can not have a way to check it front end but you could make it seem like it.
Your servlet in this instance would use a push technology such as Comet to send the status of that file such as too big or completed back to the UI.

What is the best way to transfer images from a server to an iPhone app?

What is the best way to transfer images from a server to an iPhone app? Is sending a base64 string faster or sending a link to the image source and then downloading from this source?
Is sending a base64 string faster
Definitely not - base64 is, on average, 1.4x larger than binary. (http://en.wikipedia.org/wiki/Base64)
or sending a link to the image source and then downloading from this source?
I'm not sure what you mean here - but two requests when you could simply make one (the request for the image) is also not a good idea.
Simply download the image like normal is the best approach.
You could make sure you're making effective use of caching and GZIP (standard HTTP stuff).
The second option is better than first,it would be better to have http link.
just make sure you load the images just once.

S3 Upload with Amazon IOS Sdk

I know its a known issue but has anyone found a way to "fix" the connection failure on iPhone in 3G of "relativly" large files ?
My application depends highly on S3 for upload and keeps failing uploads of files larger then 200KB
Depends on what's causing the failure.
An easy, albeit imperfect solution is to increase the timeout on your AmazonS3Client:
s3 = [[AmazonS3Client alloc] initWithAccessKey:S3_ACCESS_KEY_ID withSecretKey:S3_SECRET_KEY];
s3.timeout = 240;
I figured this out some time ago but forgot to update the reply, actually what was happening was that i was using an HTTP connection and it seems that if uploading Media files there are some Operators that have online "Conversors" dont know how to call them that take for instance your JPEG and "optimize" that jpg for mobile devices (this also applies to other media types), and since that modified the file that wont match S3 Header with the file "HASH", the way i worked around the problem was to use an HTTPS connection which prevents those intermediary servers to modify my upload

Why does the iPhone request an .m3u8 playlist file 4 times?

Why does the iPhone request an .m3u8 playlist file 4 times? And, is it possible to get it to request it only once?
The requests are performed as follows:
The first one is a full request.
The second one is a byte range request with a range of 0-1.
The third is another byte range request for the complete file.
The final request is again a complete request.
Note: that the iPhone kills the connection on these requests so not all of them complete to the end.
However, there is a lot of unnecessary requests in my opinion and I would like to know why the iPhone does this and whether or not it's possible to get the iPhone to request the original playlist only once?
It sounds like the iPhone is checking for changes in your m3u8 file, to see if you have added any .ts files. It does this because it thinks your m3u8 file is a live stream.
If you have a fixed length (VoD) stream, try putting
#EXT-X-ENDLIST
at the end of your m3u8 file
I would guess the client is sampling the file and measuring client connection speeds by downloading byte ranges from the file(s). Without source or further documentation we can't know for sure.