Nazik
Nazik

Reputation: 8444

Issues in uploading images to folder

Im using the below code for uploading

-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{
NSData * dt = UIImageJPEGRepresentation([info objectForKey:@"UIImagePickerControllerOriginalImage"],1);
NSURL *url = [NSURL URLWithString:@"http://www.mysite.com/myfolder"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setDelegate:self];
[request setData:dt withFileName:@"myphoto.jpg" andContentType:@"image/jpeg" forKey:@"photo"];
[request startAsynchronous];
}    

Here, I need to know

▪whether Im using the correct url, some used upload.php in url,what's the need to use .php extensions in url,should there be any php file in my site to upload the image

▪then what is forkey: some of them said three types of key, picture,photo and image,im not sure about it.

▪once I completed uploading images to server,what's the url to download that image, is the below url correct for above code -@"http://www.mysite.com/myfolder/myphoto.jpg"

Upvotes: 1

Views: 263

Answers (1)

Krrish
Krrish

Reputation: 2256

▪ whether Im using the correct url, some used upload.php in url,what's the need to use .php extensions in url,should there be any php file in my site to upload the image

Yes, you need a php script for reading your image data and storing it to your server folder.
links
1. w3schools upload file php
2. tutorial 1
3. turorial 2
4. StackOverflow links One, Two

▪ then what is forkey: some of them said three types of key, picture,photo and image,im not sure about it.

This is how to upload an image from iphone

▪ once I completed uploading images to server,what's the url to download that image, is the below url correct for above code -@"http://www.mysite.com/myfolder/myphoto.jpg"

Yes, If you are moving the images to myfolder using php script then this url is correct

Upvotes: 1

Related Questions