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 7718207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:06:33+00:00 2026-06-01T03:06:33+00:00

Im struggling here for a lot, Im trying to upload an image from iphone

  • 0

Im struggling here for a lot,
Im trying to upload an image from iphone to (iis)server folder using webservice asmx(VB.net)

Ive searched a lot and finally used the following code

- (IBAction)btnPostImages_Clicked:(id)sender  {

NSMutableURLRequest *request;

request = [[[NSMutableURLRequest alloc] init] autorelease];

[request setHTTPMethod:@"POST"];

[request setURL:[NSURL URLWithString:@"http://192.168.0.2/digita/digitacampus.asmx/SaveImage"]];

NSString *boundary = [NSString stringWithString:@"---------------------------14737809831466499882746641449"];

NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];

[request addValue:contentType forHTTPHeaderField: @"Content-Type"];

NSMutableData *body = [NSMutableData data];

[body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];

[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n",@"recFile",@"image.jpg"]dataUsingEncoding:NSUTF8StringEncoding]];


[body appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];

[body appendData:[NSData dataWithData:dt]];

[body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];

[request setHTTPBody:body];

NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self];

}

dt is NSData of image in jpeg representation

and the webmethod as follows

<WebMethod()> _
Public Function SaveImage(ByVal recFile As String) As String
    Dim file As HttpPostedFile = HttpContext.Current.Request.Files("recFile")
    Dim targetFilePath As String = HttpContext.Current.Server.MapPath("") + file.FileName
    file.SaveAs(targetFilePath)
    Return file.FileName.ToString()
End Function

Nothing happened

Is the above webmethod correct

I have also tried simply as below

    - (IBAction)btnPostImages_Clicked:(id)sender  {

NSURL *url = [NSURL URLWithString:@"http://192.168.0.2/digita/digitacampus.asmx/SaveImage"];

NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];

[req addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];

[req addValue:@"image/jpeg" forHTTPHeaderField:@"Content-Type"];

[req setHTTPMethod:@"POST"];

[req setHTTPBody:dt];

NSURL *conn = [[NSURLConnection alloc] initWithRequest:req delegate:self];
}

I dont know what to do else

whats the mistake that I did

How can I identify the image was successfully uploaded or not

  • 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-06-01T03:06:34+00:00Added an answer on June 1, 2026 at 3:06 am

    Is the URL correct? I think it should be something like: digitacampus.asmx?op=SaveImage and maybe digitalcampus.asmx

    You have to convert the String to an filestream like this for example:

    Dim fs As FileStream
    fs.Write(System.Convert.FromBase64String(recFile), 0, pdfLength)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling with reading characters from console in c++. Here is what I tried
I'm struggling with securing IIS hosted svc WCF service hosted in Azure using WIF
Struggling a bit on this... I'm using crontab for a lot of todo list
Using MVC3.NET I have a file upload method in a controller that works fine
I'm struggling here a lot really. I need to prepare a form that is
I am struggling a lot with this code I am trying to get to
I'm struggling here with a problem: I have a controller questions which has action
Rails newbie here struggling with a small project. I am creating a simple ship
im struggling with syntax here: hopefully this question is v simple, im just miising
I kind of am struggling with OpenSSL over here. I downloaded the current release

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.