Hi there,
Currently working on a script to show the progress of an upload using PHP and AJAX. How would this be possible? Because my script doesn't seem to work, tried something like this:
But upon submitting the form, the page refreshed and the uploadProg() ajax function ( which calls the PHP script to upload the file ) was not executed..Code:<form method="POST" id="uploadForm" action="<?=$_SERVER['PHP_SELF'];?>" enctype="multipart/form-data" onSubmit="uploadProg()"> <input type="file" name="uploadfile"> <input type="button" value="Upload File!" name="upload" onClick="document.forms['uploadForm'].submit();"> </form> <div id="uploadProg"> </div>
Could someone please help me?
Thanks in advanced!
If you use this:
You can prevent the page from submitting by returning false.HTML Code:onSubmit="return uploadProg();"
Since the page submits and the function never gets called, this could indicate an error in the js. Use firebug to isolate the error.
Are you using firebug? Check to see if you get any console errors.
Set a break point in uploadProg() and step through each line until you notice the issue.
Thanks a lot
Will have a look into Firebug too, would make it lot easier with all small javascript bugs in my scripts ;D
Though, I think I'll be using SWFUpload which I found posted on another website which seems to be doing this job (progress bar of uploading) great!
And as I'm more of a PHP/MySql coder than javascript, such scripts can come handy to me
Cheers.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks