/    Sign up×
Community /Pin to ProfileBookmark

PHP Upload pregress meter

I’m interesting in building a PHP progress meter that will reflect the progress so far, the total size of the file

Hacking the PHP interpreter is not a possibility, simply because i don’t have the access to recompile php

I read about a guy that succeed to accomplish that by presenting the progress in a new pop-up window, without recompiling PHP

I don’t see how that could help since PHP doesn’t give you access to POST raw data

Any ideas anyone?
Thanks to all helpers!

to post a comment
PHP

14 Comments(s)

Copy linkTweet thisAlerts:
@so_is_thisOct 27.2006 — Given the circumstances you've specified, and the fact that you're talking about an HTTP file upload, this is not possible to accomplish using PHP. Your code does not even get control until the file upload has been completed -- and client code (JavaScript) loses control before the file upload starts.
Copy linkTweet thisAlerts:
@HellgYauthorOct 27.2006 — Given the circumstances you've specified, and the fact that you're talking about an HTTP file upload, this is not possible to accomplish using PHP. Your code does not even get control until the file upload has been completed -- and client code (JavaScript) loses control before the file upload starts.[/QUOTE]
Yeah, my tests showed that the $_FILES array is only filled once the file was fully uploaded

There are methods, but non of them allows you to get the obtain the total size of the file(before it is uploaded), and therefore a relative progress for the moment

Unless the user will make the calculation himself that is not any use

I'll be willing to use FTP upload tho... if that will help me solve my problem
Copy linkTweet thisAlerts:
@so_is_thisOct 27.2006 — I would not expect much success with FTP either. Because, once again, you specify a file to be sent -- not a buffer of part of a file. You are also not the one reading in the file content -- FTP does that. So... You would really need to "reinvent the wheel" and use your own TCP/IP socket to send a buffer at a time. That would give you complete control.
Copy linkTweet thisAlerts:
@HellgYauthorOct 27.2006 — I would not expect much success with FTP either. Because, once again, you specify a file to be sent -- not a buffer of part of a file. You are also not the one reading in the file content -- FTP does that. So... You would really need to "reinvent the wheel" and use your own TCP/IP socket to send a buffer at a time. That would give you complete control.[/QUOTE]
Any ideas where i start?
Copy linkTweet thisAlerts:
@so_is_thisOct 28.2006 — What exactly is the audience you're trying to service? Because, in the browser-based web world you're kindof limited. Great emphasis is placed on protecting the client end and that is what is limiting your options. To get anywhere along the lines you're talking about, you really need to create a browser plugin in order to give yourself that kind of control.
Copy linkTweet thisAlerts:
@so_is_thisOct 28.2006 — Note that the above reference is for a fake progress meter powered by JavaScript. If that satisfies your need, and JavaScript is enabled for your target audience, then that is the simplest solution.
Copy linkTweet thisAlerts:
@HellgYauthorOct 28.2006 — AJAX can serve my purpose, but i can't generate an actual progress meter without patched PHP, i can only display the amount of bytes uploaded so far
Copy linkTweet thisAlerts:
@bathurst_guyOct 28.2006 — Well it shouldnt be that hard if you can get that. Can't you use JavaScript to firstly see the total size of the file and do some simple maths of what has been uploaded so far then increase the width of the progress meter.
Copy linkTweet thisAlerts:
@HellgYauthorOct 28.2006 — Well it shouldnt be that hard if you can get that. Can't you use JavaScript to firstly see the total size of the file and do some simple maths of what has been uploaded so far then increase the width of the progress meter.[/QUOTE]

I don't think there is a method for that
Copy linkTweet thisAlerts:
@so_is_thisOct 28.2006 — There is only a method for that in IE (ActiveX FSO) -- and, even then, I don't think that method can be used except from a local web page. This is where a browser plugin would come in. A browser plugin could determine the file size on the client's system before upload.
Copy linkTweet thisAlerts:
@HellgYauthorOct 28.2006 — There is only a method for that in IE (ActiveX FSO) -- and, even then, I don't think that method can be used except from a local web page. This is where a browser plugin would come in. A browser plugin could determine the file size on the client's system before upload.[/QUOTE]

Does this plugin exists on all IE browsers?, i won't be required to install it in the client's machine?.

Even if so, i am a FireFox user, and neglecting FireFox is unforgivable, and will cost me a great deal.
Copy linkTweet thisAlerts:
@maiku_no_jutsuOct 28.2006 — Find a Flash program that does uploads and shows a progress meter
Copy linkTweet thisAlerts:
@so_is_thisOct 29.2006 — Does this plugin exists on all IE browsers?, i won't be required to install it in the client's machine?.

Even if so, i am a FireFox user, and neglecting FireFox is unforgivable, and will cost me a great deal.[/QUOTE]

There would have to be a separate plugin for each browser and, yes, the user would be required to install it.
×

Success!

Help @HellgY 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 4.29,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...