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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:46:07+00:00 2026-06-14T13:46:07+00:00

I am uploading an image to an asmx web service. The file upload works

  • 0

I am uploading an image to an asmx web service. The file upload works fine, but I am wondering how to access the parameters that I set in the javascript for the filetransfer.

I want to pass the image number to the asmx SaveImage web method. Then after the file has successfully been saved I want to return the image number to the Javascript.

//Javascript Calling Web Service
function uploadPhoto(imageURI, imageNumber) {

  var options = new FileUploadOptions(),
        params = {},
        ft = new FileTransfer(),
        percentLoaded = 0.0,
        progressBar = $(".image" + imageNumber + " > .meter > span");

    options.fileKey = "file";
    options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
    options.mimeType = "image/jpeg";

    params.value1 = "test";
    params.value2 = "param";

    options.params = params;

    //get progress of fileTransfer for progress bar
    ft.onprogress = function (progressEvent) {
       if (progressEvent.lengthComputable) {
           percentLoaded = Math.round(100 * (progressEvent.loaded / progressEvent.total));
           progressBar.width(percentLoaded + "%");
       } else {
           //loadingStatus.increment();
       }
   };
   ft.upload(imageURI, "http://mysite.com/test/uploadPhotos.asmx/SaveImage", win, fail, options);

}

//.asmx web service

[WebMethod]
public string SaveImage()
{
    string rootPathRemote = WebConfigurationManager.AppSettings["UploadedFilesPath"].TrimEnd('/', '\\') + "/";
    string rootPhysicalPathRemote = rootPathRemote + "\\";
    int fileCount = 0;

    fileCount = HttpContext.Current.Request.Files.Count;
    for (int i = 0; i < fileCount; i++)
    {
        HttpPostedFile file = HttpContext.Current.Request.Files[i];
        string fileName = HttpContext.Current.Request.Files[i].FileName;
        if (!fileName.EndsWith(".jpg"))
        {
            fileName += ".jpg";
        }
        string sourceFilePath = Path.Combine(rootPhysicalPathRemote, fileName);
        file.SaveAs(sourceFilePath);
    }
    return "test";
}
  • 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-14T13:46:08+00:00Added an answer on June 14, 2026 at 1:46 pm

    To get the parameters passed to the asmx web method you can use the Request.Params…

    I added the following lines to my code

    javascript //add a parameter with a key of imageNum

    params.imageNum = imageNumber;
    

    added to .asmx [Web Method]

    string allParams = "";
    NameValueCollection parameters = HttpContext.Current.Request.Params;
    string[] imageNum = parameters.GetValues("imageNum");
    for (int j = 0; j < imageNum.Length; j++)
    {
        allParams += imageNum[j].ToString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So i'm uploading any image file via my great upload form and it uploads
CodeIgniter upload library only supports uploading image file from PC. I am trying to
I'm programatically uploading image files and want to set the filename. When I upload
I'm trying to build a quick and simple image uploading service with Node, that
I am uploading image using filedrop.js. Code in application.js file looks like this:- $(.droparea).each(function(event){
Instead of uploading image one by one, how do i achieve to upload all
I am uploading image to server using base64 its working fine if image is
I am uploading an image to a folder name upload. Then I am changing
After uploading an image file (with Greek filename) on my website the image was
I am uploading a image file to the server. Now after uploading the file

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.