I have a strange issue using the ASIHTTPRequest library when I attempt to upload images to a php script. I have implemented ASIHTTPRequest correctly, as in the php script does receive the POST data from the iphone simulator, but only for some of the images in my testing set. There are other images that don't pass through the POST.
All images were retrieved from Facebook, and are either jpg or png format. I have tested my code on both types of images, though it shouldn't matter because I use the PNGRepresentation method in my iphone application to convert the image to NSData. I have also tested size of an image, and this is not an issue (ranging from 600x600 to 1200x1200).
The images that break the ASIHTTPRequest don't seem special at all to me, and I am having trouble identifying the bug. Below is some of my implementation:
iPhone Implementation:
[RegisterRequest setData:profilePicturePNG withFileName:filename andContentType:@"image/png" forKey:@"profilePicture"];
[RegisterRequest addRequestHeader:@"Content-Type" value:@"image/png"];
[RegisterRequest setDelegate:self];
[RegisterRequest startAsynchronous];
PHP Implementation:
echo "Upload: " . $_FILES["profilePicture"]["name"] . "<br>";
echo "Type: " . $_FILES["profilePicture"]["type"] . "<br>";
echo "Size: " . ($_FILES["profilePicture"]["size"] / 1024) . " kB<br>";
echo "Temp file: " . $_FILES["profilePicture"]["tmp_name"] . "<br>";
In this test, the PHP implementation should echo the file properties. As I said earlier, for most images I do get an echo back. But there are some images where name and type don't go through and size is reported as 0kb.
Any suggestions? I would greatly appreciate it!