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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:55:17+00:00 2026-06-16T04:55:17+00:00

I am attempting to use an upload jquery control. The code below successfully connects

  • 0

I am attempting to use an upload jquery control. The code below successfully connects to my ASP.Net Handler and process’s files fine. After processing I need to send back a string of data to the client.

Here is the example I am working off..

I am having issues with a few things..

1) How to I send data back to the client from a Handler

2) Is anyone familiar to understand where to catch the code on the Handlers success. I dont see an OnComplete, done method to subscribe too.

Here is my Handler..

  public class FileUpload : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {

            if (context.Request.Files.Count == 0)
            {

                LogRequest("No files sent.");

                context.Response.ContentType = "text/plain";
                context.Response.Write("No files received.");

            }
            else
            {

                HttpPostedFile uploadedfile = context.Request.Files[0];

                string FileName = uploadedfile.FileName;
                string FileType = uploadedfile.ContentType;
                int FileSize = uploadedfile.ContentLength;

                LogRequest(FileName + ", " + FileType + ", " + FileSize);

                string theName=uploadedfile.FileName.Substring(uploadedfile.FileName.LastIndexOf('\\'));

                uploadedfile.SaveAs(HttpContext.Current.Server.MapPath("/Upload") + theName);

                context.Response.ContentType = "text/plain";
                context.Response.Write("{\"name\":\"" + FileName + "\",\"type\":\"" + FileType + "\",\"size\":\"" + FileSize + "\"}");

                context.Response.Write("Hi From Handler");
            }

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }

Here is my client code..

 <script>
            /*global $ */
            $(function () {
                $('#file_upload').fileUploadUI({
                    url: 'FileUpload.ashx',
                    method: 'POST',
                    uploadTable: $('#files'),
                    downloadTable: $('#files'),
                    buildUploadRow: function (files, index) {
                        return $('<tr><td>' + files[index].name + '<\/td>' +
                            '<td class="file_upload_progress"><div><\/div><\/td>' +
                            '<td class="file_upload_cancel">' +
                            '<button class="ui-state-default ui-corner-all" title="Cancel">' +
                            '<span class="ui-icon ui-icon-cancel">Cancel<\/span>' +
                            '<\/button><\/td><\/tr>');
                    },
                    buildDownloadRow: function (file) {
                        return $('<tr><td>' + file.name + '<\/td><\/tr>');
                    },
                    parseResponse: function (data) {
                        alert("yo");
                    }
                });    
            });

        </script> 
  • 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-16T04:55:19+00:00Added an answer on June 16, 2026 at 4:55 am

    1) How to I send data back to the client from a Handler

    Th way you are doing it seems correct, just write it out to the response stream.

    2) Is anyone familiar to understand where to catch the code on the
    Handlers success. I dont see an OnComplete, done method to subscribe
    too.

    I haven’t worked with the fileUploadUI plugin but based on the docs the send method returns a jqXHR object which you should be able to bind to the success function

    Here’s the snippet from the documentation

    var jqXHR = $('#fileupload').fileupload('send', {files: filesList})
        .success(function (result, textStatus, jqXHR) {/* ... */})
        .error(function (jqXHR, textStatus, errorThrown) {/* ... */})
        .complete(function (result, textStatus, jqXHR) {/* ... */});
    

    Edit:
    There are supposed to be two ways you can bind to the callbacks, either by passing them in with the options object, or later by binding event listeners to the widget element.

    For example:

     $('#fileupload').fileupload({
             always: function (e, data) {
               //the jqXHR is a property of the data object        
             },
         //rest of the options
       });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am encountering difficulties when attempting to use the ASP.NET File upload control. What
I am attempting to use the Jquery file upload addon to asynchronously upload files
Attempting to use asp.net mvc's Action Result of File. So it would seem that
I am attempting to use the following code to upload a photo to Facebook
In attempting to use the Performance Tools on an ASP.NET website I'm getting various
I am attempting to use jQuery Multiple File Upload , but having problems with
I am attempting to use FTP in Powershell to upload a file. I am
I'm attempting to use Panda with my GWT application. I can upload videos directly
I'm attempting to upload a file into a jsp and then use the file
i am attempting to use jquery gzoom: http://lab.gianiaz.com/jquery/gzoom/ This is my jquery: $(.zoom_no_lbox).gzoom({ sW:

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.