0

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?)

Ghostino Doggio
  • 351
  • 1
  • 4
  • 11

1 Answers1

0

try:

NSData *imageData = UIImagePNGRepresentation(yourUIImage);
[request setData:imageData withFileName:@"myphoto.jpg" andContentType:@"image/jpeg" forKey:@"file"];
TompaLompa
  • 949
  • 6
  • 17
  • you can enter any name. You already loaded the image into the UIImage from your file. The first line in the code above makes it a datarepresentation of the image. You then upload the data and set the name arbitrarly in the _withFileName_ parameter. – TompaLompa Apr 15 '12 at 08:49
  • Thanks, I got it. But I was hoping to that "anyname.jpg" parameter was something automatically generating IDs(or something like that). – Ghostino Doggio Apr 16 '12 at 02:39