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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:15:30+00:00 2026-05-13T18:15:30+00:00

i have a problem with jquery form plugin. I try to upload a file

  • 0

i have a problem with jquery form plugin.
I try to upload a file asynchronously but it does not submit the form.
html markup and javascript code are like below

<form id="fileUploadForm" method="post" action="Default.aspx" enctype="multipart/form-data">
<input type="text" name="filename" />
<input type="file" id="postedFile" name="postedFile" />
<input type="button" value="Submit" onclick="UploadFile();" />
</form>

$(document).ready(function() {

        $('#fileUploadForm').ajaxForm();            
    });

function UploadFile() {

        var options =
        {                
            url:"Default.aspx",                
            beforeSend: ShowRequest,
            success: SubmitSuccesfull,
            error:AjaxError                               
        };            
        $("#fileUploadForm").ajaxSubmit(options);
        return false;
    }. 

I have another test form it has only a textbox in it and it works fine. Also when i comment the input type=”file”… line the above form works fine too. What is the problem with input type file?
Any Idea?

  • 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-13T18:15:30+00:00Added an answer on May 13, 2026 at 6:15 pm

    In short:

    <input type="file" />
    

    Cannot be submitted via ajax, it has to be a full postback. Traditionally you use an iFrame for this if you want AJAX style behavior. I’ve used a few solutions to this, without knowing what platform you’re on, SWFUpload is usually a good option.

    Here’s a full document example of a fix:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <script type="text/javascript" src="Javascript/jquery-1.3.2.js"></script>
        <script type="text/javascript" src="Javascript/jquery.form.js"></script>
        <script type="text/javascript">
            $(function() {            
              $('#fileUploadForm').ajaxForm({                 
                beforeSubmit: ShowRequest,
                success: SubmitSuccesful,
                error: AjaxError                               
              });                                    
            });            
    
            function ShowRequest(formData, jqForm, options) {
              var queryString = $.param(formData);
              alert('BeforeSend method: \n\nAbout to submit: \n\n' + queryString);
              return true;
            }
    
            function AjaxError() {
              alert("An AJAX error occured.");
            }
    
            function SubmitSuccesful(responseText, statusText) {        
              alert("SuccesMethod:\n\n" + responseText);
            }    
        </script>
    </head>
    <body>
        <form id="fileUploadForm" method="POST" action="Default.aspx" enctype="multipart/form-data">
          <input type="text" name="filename" />
          <input type="file" id="postedFile" name="postedFile" />
          <input type="submit" value="Submit" />
        </form>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Fact: I'm not that good with jQuery. Problem: I have a form containing dynamically
I have a problem with Jquery function getJSON, the action url does not trigger
I have a problem with my form when I try to submit with ajax.
I have made my own jQuery plugin, but it has problem that values I
I made my first jQuery plugin attempt, but I have this problem/bug which I
I am using the jQuery form validation plugin. The problem I have is that
I have two bits of code: a form and a jQuery function. My problem
I have a problem with jQuery, I want to change a DIV (not the
I have some problem with Jquery Autocomplete plugin ( http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ ) I got it
I am using jquery validation plugin to validate my form. I have one field

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.