How do i get the image name of a image in imageView?
Hi i want to upload the image to HTTP server, image upload is working fine but every time the image in the server is replace开发者_运维技巧d with the new image. Can some one help me to implement the commented lines below. Thanks...
- (IBAction)upload{ //NSString *imagename=imageview.image; //[self uploadImage:UIImageJPEGRepresentation(imageview.image, 1.0) filename:imagename]; [self uploadImage:UIImageJPEGRepresentation(imageview.image, 1.0) filename:@"facebook.jpg"]; }
To get the image's filename, capture the name during the file picking (but remember, maybe the image in the image view comes directly from the camera).
If the file upload should never overwrite a file already on the server, consider one of the following:
a) generate a unique filename for each upload (preferably in the server code, but if you also control the client, you can do it there too). You could use UUIDs as unique filenames.
OR
b) store the images in a database instead of the filesystem
精彩评论