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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:18:23+00:00 2026-06-01T06:18:23+00:00

I am working on a jQuery live file upload. There is a form in

  • 0

I am working on a jQuery live file upload.

There is a form in my application with a file field. when the user selects a file, then I need to upload it using the AJAX file upload method. Then later when user submit on the “Submit” then the real file upload will take place .

Using the following, my AJAX file upload is going perfectly. But the problem is that after the file upload, the file field’s value will get cleared.

var url = $('#site').val()
url = url + "/ajax/addTmpImg";

var id = 'my_file';

alert($('#' + id).val()); // THIS WILL SHOW FILE FIELD VALUE

$.ajaxFileUpload({
    url: url,
    secureuri: false,
    fileElementId: id,
    dataType: 'json',
    data: {
        'type': file_name,
        'name': file_name
    },
    success: function (data, status) {
        alert($('#' + id).val()); // THIS WILL RETURN EMPTY
    },
    error: function (data, status, e) {
        alert(status);
    }
});

Before the file upload, this will alert the file field’s value and after the file upload, doing the same will show nothing.

  • 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-01T06:18:24+00:00Added an answer on June 1, 2026 at 6:18 am

    Try to define a global variable and assign the value $('#'+id).val() to that variable.

    Like this:

    var someVar = $('#'+id).val();
    

    You can access that variable later.

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

Sidebar

Related Questions

I'm using the jquery form plugin ( http://malsup.com/jquery/form/ ) to upload a file via
I am getting strange behaviour when trying to upload files, using jQuery multi-file plugin,
I'm working with jquery. And i have text input in a form, i would
I been sort of using jquery livequery plugin and jquery live together. However now
my actual problem is that .live() jQuery method is not working. This si the
I am working with JQuery and making a ajax call to delete some stuff
I am working on ASP .Net MVC 3 application. I am using the table
I am working with JQuery dialog which is opened before an ajax call and
I am working with jQuery mobile and using the HTML5 audio tag. I have
I'm working on an ASP.NET MVC project using jQuery. I'm referencing the jQuery VSDoc

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.