i have decided recently that making or getting a good upload progress bar
was too much of a hassle so i wanted to throw that idea in the bin
now i just want the file to upload but i still want a indicator that tells
the user that a file is being uploaded.
so my question is this:
how do i display an image when i click submit and remove the image when the file is done uploading?
any good javascript and/or php functions for this?
display an image while uploading
Moderator: General Moderators
Re: display an image while uploading
If I understood you well, I think that is impossible. because you can't display something that you are uploading.ryuuka wrote: so my question is this:
how do i display an image when i click submit and remove the image when the file is done uploading?
any good javascript and/or php functions for this?
My two cents.
It'll need Javascript, but it could be rewritten to use JS if the user has it and to use a normal submit button if they don't.
Your form is being sumitted, so removing the image isn't necessary because they'll be loading a new page (or reloading the same page if you're submitting the page to itself).
Code: Select all
<script>
function displayThenUpload() {
var myImage = getElementById('progressbar');
myImage.style.display = 'block';
document.myForm.submit();
}
</script>
<img id="progressbar" src="progressbar.gif" style="display: none;">
<form name="myForm">
Upload: <input type="file" name="myUpload">
<input type="button" value="Submit" onClick="displayThenUpload()">
thanks for the info but i see i formulated my question in the wrong way
when i upload a file (zip) and it's like 200mb in size it will take a while
to upload so when i clcik the submit button i want to display an image like this one:

and i want it to dissapear when the upload is finished
this is so that the users know their file is being uploaded
hope this clarifies it a bit
when i upload a file (zip) and it's like 200mb in size it will take a while
to upload so when i clcik the submit button i want to display an image like this one:

and i want it to dissapear when the upload is finished
this is so that the users know their file is being uploaded
hope this clarifies it a bit
k
misinterpeted your source and used a different one but it does exactly the same
function at the start of the page:
implementation of the function at the submit button:
thanks for your advice it helped
misinterpeted your source and used a different one but it does exactly the same
function at the start of the page:
Code: Select all
<script language="JavaScript">
<!--
function showProgress() {
document.getElementById("progress").style.visibility = 'visible';
document.getElementById("submit").disabled = true;
}
//-->
</script>Code: Select all
<input type=submit value=upload onclick="javascript:showProgress();">
<span id="progress" style="visibility:hidden"><img src="indicator_square.gif"/>thanks for your advice it helped
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact: