问题
I got a UIImage object with no name. (but when I save UIImage to my photo library it gets a name like IMG_00000.jpg)
I just don't know how to use this name for request parameter. (or whatever name it is...)
That should be like,
`[request addData:imageData withFileName:@"%@.jpg", self.IDON'TGETIT]`
what can I use for name of this UIImage?
How can I make it? (property? is there protocol or something?)
回答1:
try:
NSData *imageData = UIImagePNGRepresentation(yourUIImage);
[request setData:imageData withFileName:@"myphoto.jpg" andContentType:@"image/jpeg" forKey:@"file"];
来源:https://stackoverflow.com/questions/10136637/iphone-uploading-uiimage-object-to-server-via-asihttprequest-photo-name