I have this form
<form id="uploadFile" enctype="multipart/form-data">
<h3>Upload a file:</h3>
<input type="file" name="fileToUpload" id="fileToUpload" class="fileToUpload"/>
<input type="submit" id="submit" value="Upload" name="submit"/>
</form>
And this jQuery code for the submit function (all in the same php file):
$('#uploadFile').submit(function()
{
$old=$("#activity").html();
event.preventDefault();
$.ajax(
{
url: "upload.php",
type: 'POST',
data: new FormData(this),
contentType: false,
cache: false,
processData: false,
success: function(data)
{
$('.info').html(data);
$('.info').show();
$("#content").load("this_same_file.php");
}
});
});
It works fine. What I need to do is to 'automate' the 'submit' call. I mean, once I clicked OK on the pop-up file window, I would like to submit automatically the form.
I tried to follow the suggestions posted on the thread How do I auto-submit an upload form when a file is selected? but the only thing I can do is a window.alert advertising me that I have clicked the OK button of the pop-up window.
How can I implement this feature in my code ? Thank you in advance for your help.