Read header files and do something before full photo upload happens


Read header files and do something before full photo upload happens



I am passing a GUID as a header and a photo as a body to a php file. The GUID is used to authenticate. If it's not valid, I want to end the call and I do this using

die("GUID was expired"); 

This works fine, but my issue is that the whole photo is uploading before that gets called. This is bad for the user. I want to read the header and have the upload wait until I do the validity check. Is this possible in php? So rather than uploading the photo, then getting a failed response, just upload the headers from objective c, if the Guid is valid, then upload the photo.

Thanks!




Reformatting for landscape view

1:



Fade in/out UIScrollView's content like Mobile Safari does in its tab
I don't believe that's possible in PHP; the browser will POST the image content body before PHP ever gets a say in the matter.


warning: declaration does not declare anything
.
How to Base64 encoding on the iPhone
One (slightly complicated) solution to this problem would be to do a HEAD request with an XMLHttpRequest just before the form is submitted using JavaScript.


UIWebView slow loading images--disturbs scrolling to anchors
If the request failed, you could display an error message to the user or redirect to a login page.


iPhone / .NET WCF Interoperability
Otherwise, let the form submit as usual.


UIScrollView
Of course, the GUID could expire between the HEAD request and the subsequent POST, so it's not completely fool-proof..
How can I decode data with Base64 in IPhone



68 out of 100 based on 53 user ratings 328 reviews