Iphone> Uploading UIImage object to server via ASIHTTPRequest, photo name?

馋奶兔 提交于 2019-12-11 19:46:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!