Setting an ASIHTTPRequest post to a SimpleHTTPServer Python server?
Posted
by
Rob
on Stack Overflow
See other posts from Stack Overflow
or by Rob
Published on 2011-02-25T04:26:31Z
Indexed on
2011/02/25
7:25 UTC
Read the original article
Hit count: 259
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?
© Stack Overflow or respective owner