Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7411779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:26:24+00:00 2026-05-29T06:26:24+00:00

I want to upload images in server using ASIHTTPRequest library in my IPhone app.

  • 0

I want to upload images in server using ASIHTTPRequest library in my IPhone app.

For image upload, i am using ASIFormDataRequest to upload into server.

I have tried the below codes in my app but it couldn’t working and image didn’t uploaded in server.

NSURL *url = [NSURL URLWithString:@"http://www.anglerdemo.com/Appln/Aghaven_iphone/Uploadphoto.php"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
request.requestMethod = @"POST";
NSString *fileName = @"iphone.jpg";
[request addPostValue:fileName forKey:@"name"];

// Upload an image
UIImage *img = [UIImage imageNamed:fileName];
NSData *imageData = UIImageJPEGRepresentation(img, 90);
NSLog(@"imageData ==> %@", imageData);
[request setData:imageData withFileName:fileName andContentType:@"image/jpeg" forKey:@"image"];
[request setDelegate:self]; 
[request startAsynchronous];

I have tried above codes in my app, request successfully executed and i got the alert message in “requestFinished” delegate method of ASIHTTPRequest. but image didn’t uploaded in server.

- (void)requestFinished:(ASIHTTPRequest *)request
 {

[[[[UIAlertView alloc] 
   initWithTitle:@"Message" 
   message:@"Success!!!" 
   delegate:self 
   cancelButtonTitle:@"OK" 
   otherButtonTitles:nil] 
  autorelease] 
 show];

NSLog(@"success ==> ");
}

I have tried php file script for upload is below.

<?php
   $uploaddir = 'upload_files/';
   $file = basename($_FILES['image']['name']);
   $uploadfile = $uploaddir . $file;

   if(move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile))
  {
   echo "Photo has been saved successfully!…;
  }
  else {
echo "Failed";
  }
?>

Please help in this regards.

Thanks!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:26:25+00:00Added an answer on May 29, 2026 at 6:26 am

    I think the first thing I would do is add

    NSLog(@"%@", [request responseString]);
    

    to requestFinished: just to be sure you see “Failed” being logged. This will prove the problem is with the attempt to call move_upload_file, which I would guess is where things go wrong.

    If that’s the case, I would be pretty sure that the user your webserver runs as doesn’t have write permissions to the upload_files directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to upload images from a phone device into a computer web-server using
How to do the following: I want to have a link [upload image] which
Let's say i have an image uploader script, i want to prevent the upload
I want to upload and store video files to my server using PHP. Could
I need to upload a single image to server. The project is using .NET
I want to upload images from the client to the server. I already managed
I have an asp button that is used to upload images (using uploadify) and
I simply want to upload an image to a server with POST. As simple
Okay, I have a question guys. I want to remote upload (copy an image
I am, using a cakephp form helper to upload images to my server. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.