/    Sign up×
Community /Pin to ProfileBookmark

getting an indication on a file upload progress

Hello

I was wondering whether it was possible to get an indication on the progress of the upload a file to a server.

I would like to allow a user to upload a file, using the <input type=”file”> tag.
The image could potentially be very large. As such I would like to display a popup window which will display a progress bar indicating the progress of the upload process.

I was wondering whether it is possible to get an indication on how many bytes have been uploaded to the server so far, so I could update the popup window to reflect how many bytes have been uploaded.

For example, the popup window would say:
“Uploaded 256K / 1.6MB, estimation: 2 minutes”
This text should change in runtime as the file is uploading. This means that the server will need to interact with the popup window (probably via an iframe).
Is the amount of bytes uploaded so far is available to me or can I obtain it somehow?

Is what I want to do at all possible using JavaScript and PHP?

I would appreciate any thought on this concept.
david

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsJul 16.2004 — that can't be done with php or javascript, you might look into java or flash
Copy linkTweet thisAlerts:
@solavarJul 16.2004 — It can also be done with cURL, so I'm just beginning to learn.
Copy linkTweet thisAlerts:
@davidklonskiauthorJul 17.2004 — Take a look at [URL=http://www.raditha.com/php/php-upload.php]Mega Upload[/URL]
Copy linkTweet thisAlerts:
@ShrineDesignsJul 18.2004 — sounds like a waste of bandwidth to me
Copy linkTweet thisAlerts:
@davidklonskiauthorJul 18.2004 — what would be a waste of bandwidth?

the overall requirement or a specific solution?
Copy linkTweet thisAlerts:
@scottOJul 23.2004 — I think what it does is it has a meta refresh tag, which refreshes it every half second or so, and the PHP script checks the filesize on their server (how much copied) and the filesize on you rcomputer (how much total size)
Copy linkTweet thisAlerts:
@ShrineDesignsJul 23.2004 — [i]Originally posted by davidklonski[/i]

[B]what would be a waste of bandwidth?

the overall requirement or a specific solution?[/B]
[/QUOTE]
it refreshes a page every second or so, and calculates the file size of the file, if the file is large, it quite possibly double the amount of time to upload it, and to refresh a page so many times an re-calculate the size, would chew up all your server's bandwidth after 10 or so uploads
Copy linkTweet thisAlerts:
@davidklonskiauthorJul 24.2004 — Since PHP has to access to the raw bytes data, it has a problem indicating the upload process.

The best solution from what I have been able to gather would be to use Perl to get the raw bytes information, updating an HTML page and once the upload is completed, Perl will notify PHP and the code will be able to continue using PHP.

correct me if I am wrong.
×

Success!

Help @davidklonski spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...