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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:24:35+00:00 2026-05-14T03:24:35+00:00

I wanted to find a way to upload a single file*, in the background,

  • 0

I wanted to find a way to upload a single file*, in the background, have it start automatically after file selection, and not require a flash uploader, so I am trying to use two great mechanisms (jQuery.Form and JQuery MultiFile) together. I haven’t succeeded, but I’m pretty sure it’s because I’m missing something fundamental.

Just using MultiFile, I define the form as follows…

<form id="photoForm" action="image.php" method="post" enctype="multipart/form-data">

The file input button is defined as…

<input id="photoButton" "name="sourceFile" class="photoButton max-1 accept-jpg" type="file">

And the Javascript is…

$('#photoButton').MultiFile({
    afterFileSelect: function(){
         document.getElementById("photoForm").submit();
    }
});

This works perfectly. As soon as the user selects a single file, MultiFile submits the form to the server.


If instead of using MultiFile, as shown above, let’s say I include a Submit button along with the JQuery Form plugin defined as follows…

 var options = {
  success: respondToUpload
 }; 

 $('#photoForm').ajaxForm(options);

… this also works perfectly. When the Submit button is clicked, the form is uploaded in the background.


What I don’t know how to do is get these two to work together. If I use Javascript to submit the form (as shown in the MultiFile example above), the form is submitted but the JQuery.Form function is not called, so the form does not get submitted in the background.

I thought that maybe I needed to change the form registration as follows…

$('#photoForm').submit(function() {
 $('#photoForm').ajaxForm(options);
});

…but that didn’t solve the problem. The same is true when I tried .ajaxSubmit instead of .ajaxForm.

What am I missing?

  • BTW: I know it might sound strange to use MultiFile for single-file uploads, but the idea is that the number of files will be dynamic based on the user’s account. So, I’m starting with one but the number changes depending on conditions.
  • 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-14T03:24:35+00:00Added an answer on May 14, 2026 at 3:24 am

    The answer turns out to be embarrassingly simple.

    Instead of programmatically submitting using…

    document.getElementById("photoForm").submit();
    

    … I used…

    $("#photoForm").submit();
    

    Also, since I only need to upload multiple files on occasion, I used a simpler technique…

    1) The form is the same as my original…

    <form id="photoForm" action="image.php" method="post" enctype="multipart/form-data">
    

    2) The file input field is basically the same…

    <input id="photoFile" "name="sourceFile" style="cursor:pointer;" type="file">
    

    3) If the file input field changes, submit is executed…

    $("#photoFile").change(function() {
        $("#photoForm").submit();
    });
    

    4) The AjaxForm listener does its thing…

    var options = {
        success: respondToUpload
    }; 
    $('#photoForm').ajaxForm(options);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a page to upload a file (single) to my server :
I wanted to find out if there is a way to have IIS 6
This is a common scenario, but i wanted to find out which way is
I'm not sure if this is possible at all, but wanted to find out
I wanted to use find to find every file in a directory that starts
I wanted to find out if ADFS2.0 provides a way for users to be
I wanted to hear whether it was possible to find a way to retrieve
I wanted to customize the JQueryUI slider but am not able to find any
I am somewhat noobish to IOS development and wanted to find the best way
I wanted to find out if there is a way to create 30 second

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.