Setting an ASIHTTPRequest post to a SimpleHTTPServer Python server?
- by Rob
I am working on a project (that i will not be releasing to the app store - just for fun) that will upload an image via an HTTP Post request from my iPhone to a server that I have running the Python script SimpleHTTPServer. I have successfully used the ASIHTTP APIs in the past for text strings, but can't for the life of me figure out how to upload an image. I have tried all of the following:
NSString *path = [[NSBundle mainBundle] pathForResource:@"Image" ofType:@".png"];
[request setFile:@"Image.png" forKey:@"file"];
[request setFile:path forKey:@"file"];
[request setFile:path withFileName:@"Image.png" andContentType:@"image/jpeg"
forKey:@"file"];
[request setData:[UIImage imageNamed:@"Image.png"] withFileName:@"Image.png" andContentType:@"Image" forKey:@"file"];
Any thoughts on where i could be going wrong?