Jump to content

Archived

This topic is now archived and is closed to further replies.

JustinMs66@hotmail.com

Upload Progress Bar

Recommended Posts

i have a working upload script, and i want to add a Progress Bar.

here is my index.php code:
[url=http://csscobalt.com/uploads/index.txt]http://csscobalt.com/uploads/index.txt[/url]

here is my current upload.php code:
[url=http://csscobalt.com/uploads/upload.txt]http://csscobalt.com/uploads/upload.txt[/url]

and i want it to be in the index.php. like once you press "Upload", a bar will appear (or it can just already be there, it dosn't have to appear) and then it will show the upload progress.

here is an example of what i want:
[url=http://php5.bluga.net/UploadProgressMeter/demo.php]http://php5.bluga.net/UploadProgressMeter/demo.php[/url]

can anyone help me with this?

Share this post


Link to post
Share on other sites
well download the code for that project and play.. no one can do better than that..
~~If you need support then you'll be needing www.ajaxfreaks.com forums as nearly everything is javascript/AJAX not php


Regards
Liam

Share this post


Link to post
Share on other sites
wul thats the thing, i'm only good at PHP, so thats why i wana make one that is in PHP, not AJAX.

so how would i go about doing this?

i was thinking maybe i could test the person who is uploading's internet speed, and then see how big the file is, and then calculate how long it would take, and just set the bar as an animation. a set speed. ...it wouldn't be exact, but it would be ok with me.

Share this post


Link to post
Share on other sites
Well you CANT do client side coding in PHP.  PHP is all server side so it would have to be AJAX or Javascript that would control the progress bar.

Share this post


Link to post
Share on other sites
The ajax isn't the hard part. Joshua Eichorn's example (the one you linked) uses his HTML_AJAX pear package and all the js is right there for you. No need to touch it at all, just handle your file once $_POST or $_FILES gets set as normal.

Same goes for Rasmus' example using yui library (looks pretty but doesn't work in ie6, so buyer beware)

The tough part is that you'll have to:
run php 5.2 with APC (alternative php cache)
patch your php installation with pdoru's patch
or use a perl script =(

The best option to me looked like running php 5.2 w/ APC which I'm currently on now. But I'm having trouble connecting to the hooks still. You can check out how I tried to get it running at [url=http://linardy.com/blog.php?post=8]http://linardy.com/blog.php?post=8[/url]

And, don't be scared of ajax, just head over to ajaxfreaks.com when you've got some time to kill, and you'll be asynchronously calling your php scripts in no time at all. Probably learn a few dom tricks too ;)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.