views:

41

answers:

1

Hi i want to upload the image to HTTP server, image upload is working fine but every time the image in the server is replaced 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"];
}
+1  A: 

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

Joubert Nel
Thanks, i used sessions of php to generate unique filename in server.
pradeepa