jaymc Posted October 2, 2006 Share Posted October 2, 2006 I'm wondering, how do you go about making a progress bar when using an upload formBasically so a user can see the percentage uploaded of their file... Quote Link to comment https://forums.phpfreaks.com/topic/22699-upload-progress/ Share on other sites More sharing options...
printf Posted October 2, 2006 Share Posted October 2, 2006 You need Perl or you need to hack the source / core, explicitly altering how rfc1867.h works, which I wouldn't recommend if you don't know C or C++ and PHP(s) core structure. There is a hack to do this, but it has memory leaks. If you check the PHP mailing list around June of 2003, Wez Furlong (PHP Team) and someone else posted a better way of doing it (supporting RAW_POST_DATA) for upload input streams!me! Quote Link to comment https://forums.phpfreaks.com/topic/22699-upload-progress/#findComment-102063 Share on other sites More sharing options...
jaymc Posted October 2, 2006 Author Share Posted October 2, 2006 Surely their is another way !Hmm.. Quote Link to comment https://forums.phpfreaks.com/topic/22699-upload-progress/#findComment-102064 Share on other sites More sharing options...
marknt Posted October 2, 2006 Share Posted October 2, 2006 [quote author=printf link=topic=110187.msg444950#msg444950 date=1159750565]You need Perl or you need to hack the source / core, explicitly altering how rfc1867.h works, which I wouldn't recommend if you don't know C or C++ and PHP(s) core structure. There is a hack to do this, but it has memory leaks. If you check the PHP mailing list around June of 2003, Wez Furlong (PHP Team) and someone else posted a better way of doing it (supporting RAW_POST_DATA) for upload input streams!me![/quote]That is correct. Im trying to search an alternative way than using Perl to implement the upload progress bar but as of now i found nothing. I'll keep on googling :) Quote Link to comment https://forums.phpfreaks.com/topic/22699-upload-progress/#findComment-102071 Share on other sites More sharing options...
Destruction Posted October 2, 2006 Share Posted October 2, 2006 I believe there may be a way to do this though I'm not 100% sure. I was considering something similar a while ago. The way I thought of doing it was to use JavaScript/AJAX/PHP. JavaScript could find the total filesize, though the only way I found so far is tricky with security permissions and unsigned ActiveX (see here: http://www.jguru.com/faq/view.jsp?EID=330134). AJAX would call a php script which would check the current filesize of the file as it's being uploaded to the server. This is where I was a little stuck personally as I don't think you can use $_FILES until after the file is uploaded. Hopefully you'll be able to find out a little more from here as I put my own research on hold some time ago.HTHDest Quote Link to comment https://forums.phpfreaks.com/topic/22699-upload-progress/#findComment-102088 Share on other sites More sharing options...
jaymc Posted October 2, 2006 Author Share Posted October 2, 2006 [quote author=Destruction link=topic=110187.msg444976#msg444976 date=1159754691]I believe there may be a way to do this though I'm not 100% sure. I was considering something similar a while ago. The way I thought of doing it was to use JavaScript/AJAX/PHP. JavaScript could find the total filesize, though the only way I found so far is tricky with security permissions and unsigned ActiveX (see here: http://www.jguru.com/faq/view.jsp?EID=330134). AJAX would call a php script which would check the current filesize of the file as it's being uploaded to the server. This is where I was a little stuck personally as I don't think you can use $_FILES until after the file is uploaded. Hopefully you'll be able to find out a little more from here as I put my own research on hold some time ago.HTHDest[/quote]Yeh thats exactly how I thought it could be donefor that to work though, you would need to know the file name the the php ["tmp"] dir and just java ajax refresh every 5 seconds and compare the uploaded so far file size to the actually file sizeIts just how to do that though.. Quote Link to comment https://forums.phpfreaks.com/topic/22699-upload-progress/#findComment-102260 Share on other sites More sharing options...
alpine Posted October 2, 2006 Share Posted October 2, 2006 Here is a freebie that you might want to check out: http://seemysites.net/projFolder/uploader/ Quote Link to comment https://forums.phpfreaks.com/topic/22699-upload-progress/#findComment-102349 Share on other sites More sharing options...
karthikeyan_coder Posted October 2, 2006 Share Posted October 2, 2006 going to check alpine's sol Quote Link to comment https://forums.phpfreaks.com/topic/22699-upload-progress/#findComment-102351 Share on other sites More sharing options...
printf Posted October 2, 2006 Share Posted October 2, 2006 You still need Perl, for that version, because it needs to pass the file(s) name to PHP, because PHP can not get at the RAW_POST_DATA, so you will be using (2) connections, (1) to upload, (1) to monitor, that keeps looping, so 10MB file, uploaded at 30Kbytes per second will send 900 requests to the server if the interval is 1.5 seconds. Lower connection speed(s) results in more looping requests!Not very smart, if you ask me!me! Quote Link to comment https://forums.phpfreaks.com/topic/22699-upload-progress/#findComment-102357 Share on other sites More sharing options...
redarrow Posted October 2, 2006 Share Posted October 2, 2006 I can do it but as a fake upload counter not a reel situation but the user dont know that ha.what i do is when a user submits the image i point the form to a update.php and then from update.php i redirect them to a page where i got a animated gif going from side to side then afther 40 sec i send them to a confirmation page with thank you but if there is a error they goto the upload page agin with a error comment.all i use is a animated image and php location syntex. Quote Link to comment https://forums.phpfreaks.com/topic/22699-upload-progress/#findComment-102378 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.