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

  • Home
  • SEARCH
  • 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 6075169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:27:51+00:00 2026-05-23T10:27:51+00:00

the following code for upload image <a id=addImage href=javascript:;>Add Image</a> Javascript: $().ready(function () {

  • 0

the following code for upload image

 <a id="addImage" href="javascript:;">Add Image</a>

Javascript:

$().ready(function () {
            var counter = 0;
            $(function () {
                var btnUpload = $('#addImage');
                new AjaxUpload(btnUpload, {
                    action: 'saveupload.aspx',
                    name: 'uploadimage',
                    dataType: 'json',
                    onSubmit: function (file, ext) {
                        $("#loading").show();
                    },
                    onComplete: function (file, response) {
                        alert(response);
                        var uploadedfile = "UserData/" + file;
                        $("#uploadImageWrapper").append("
            <div class='imageContainer offset'  id='current" + counter + "'>
            <img height='65px' width='65px' src='" + uploadedfile + "' alt='" + uploadedfile + "'/></div>");
                        $('#current' + counter).fadeIn('slow', function () {
                            $("#loading").hide();
                            $("#message").show();
                            $("#message").html("Added successfully!");
                            $("#message").fadeOut(3000);
                            counter++;
                        });
                    }
                });
            });
        });

Server code: (saveupload.aspx.cs)

protected void Page_Load(object sender, EventArgs e)
    {
        HttpFileCollection uploadedFiles = Request.Files;
        int i = 0;
        string width = "0";
        string height = "0";
        if (uploadedFiles.Count > 0)
        {
            while (!(i == uploadedFiles.Count))
            {
                HttpPostedFile userPostedFile = uploadedFiles[i];
                if (userPostedFile.ContentLength > 0)
                {
                    string filename = userPostedFile.FileName.Substring(userPostedFile.FileName.LastIndexOf("\\") + 1);
                    userPostedFile.SaveAs(Path.Combine(Server.MapPath("UserData"), filename));
                    Bitmap img = new Bitmap(Path.Combine(Server.MapPath("UserData"), filename));
                    width = img.Width.ToString();
                    height = img.Height.ToString();
                }
                i += 1;
            }
        }
    //I would like to return Uploaded image Height and Width
        Response.Write(@"{Width:" + width + ", Height:" + height + "}");
    }

and the return JsonResult is i have display in Alert message.
enter image description here

Problem:
I am not able to get response.Width and response.Height.

  • 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-23T10:27:52+00:00Added an answer on May 23, 2026 at 10:27 am

    first of all I would suggest to clean the HTML of your saveupload.aspx. You do not need it and it pollutes your response.
    You just need:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="saveupload.aspx.cs" Inherits="WebApplication1.saveupload" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    

    Another thing; when you get the response back in your script you can use parseJSON, like this:

    var obj = jQuery.parseJSON(response);

    now you should be able to access Width and Height:

    obj.Width 
    

    Last thing. Valums’ Ajax Uploader has been replaced by the author with a new component.
    You can find it here
    It’s very much similar but he’s still updating this project so you might consider to switch.

    UPDATE:

    Another thing I would suggest is to use the jSon serializer (System.Web.Script.Serialization) to serialize the stream you want to return:

    var jSon = new JavaScriptSerializer();
    var OutPut = jSon.Serialize(myClass);
    Response.Write(OutPut);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got the following code: <script type=text/javascript> $(function(){ $(#AddMaps).submit(function(){ var $form = $('#AddMaps'); $.ajax({
I have the following model(codeigniter) code to upload image and thumbnail. However the result
I am using the following code to upload an image to a web server
I want to upload an image in Zend-framework. In Application_Form_Test.php I write following code....
Hi Im using the following code: http://vikaskanani.wordpress.com/2011/01/11/android-upload-image-or-file-using-http-post-multi-part/ To POST an image to a WCF
I have the following html code to upload an image: <input type=file name=before size=40>
I'm using the following java code to upload a multi-part image to an ASMX
following code doesn't work with input: 2 7 add Elly 0888424242 add Elly 0883666666
Basically I am trying to upload an image using ASIFormDataRequest. This is my following
With the following code, my browser is returning 'image not created or saved'. I

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.