tag:blogger.com,1999:blog-34454975.post378709493747903399..comments2023-06-28T16:58:41.189+02:00Comments on Web Reflection: Upload progress bar with PHP5, APC and jQueryAndrea Giammarchihttp://www.blogger.com/profile/16277820774810688474noreply@blogger.comBlogger36125tag:blogger.com,1999:blog-34454975.post-32589755039848239852013-08-26T19:07:50.549+02:002013-08-26T19:07:50.549+02:00This post is from: Thursday, October 25, 2007
No,...This post is from: Thursday, October 25, 2007<br /><br />No, sorry, I won't help ... find something that works out of the box or suggest changes to update this post and I will.<br /><br />Sometimes contributing is better than demanding ;-)<br /><br />Thanks for understanding (I also happily stopped using PHP a while ago)Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-526569916617638772013-08-25T15:31:28.095+02:002013-08-25T15:31:28.095+02:00In my server apc_fetch() return data once file ful...In my server apc_fetch() return data once file fully uploaded in the server.<br />It returns false when file is getting uploaded so I am unable to show progress bar.<br />Please help.Rakeshhttps://www.blogger.com/profile/10754168254071692170noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-40968736996057760072010-08-28T03:43:27.979+02:002010-08-28T03:43:27.979+02:00getcwd() . DIRECTORY_SEPARATORgetcwd() . DIRECTORY_SEPARATORAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-72740393475728918202010-01-29T19:50:01.099+01:002010-01-29T19:50:01.099+01:00The var DOCUMENT_ROOT is not usable since the file...The var DOCUMENT_ROOT is not usable since the files can reside in an aliased directory. If you only want to check if PHP_SELF points to same file as __FILE__ then its probably enough to lookup the string PHP_SELF in the string __FILE__, f.e. something like that:<br />if(strpos(str_replace('\\', '/', __FILE__), $_SERVER['PHP_SELF']) !== FALSE){Guenternoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-28816873183063511852009-04-20T03:20:00.000+02:002009-04-20T03:20:00.000+02:00There is some error with the code in windows.
$_...There is some error with the code in windows. <br /><br />$_SERVER['DOCUMENT_ROOT'] = c:/test/<br />$_SERVER['PHP_SELF'] = /admin/bla.php<br /><br />you concatenates the 2 vars: <br />c:/test//admin/bla.php<br />and compares to ___file___:<br />c:/test/admin/bla.php<br /><br />you see the double //?<br /><br />the correction is:<br /><br />if(str_replace('//', '/', $_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF']) === str_replace('\\', '/', __FILE__)){Arnold Roahttp://www.arnoldroa.comnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-37117038788777440132009-03-04T17:41:00.000+01:002009-03-04T17:41:00.000+01:00awesome!awesome!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-57947558720472427392009-02-12T00:00:00.000+01:002009-02-12T00:00:00.000+01:00I have tested and indeed it doesn't work with jaun...I have tested and indeed it doesn't work <BR/>with jaunty and that patch suhosinPopa Adrian Mariushttps://www.blogger.com/profile/09862886782232467681noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-18626450720289858572008-09-23T16:05:00.000+02:002008-09-23T16:05:00.000+02:00the progress bar is not working fine for me ...i h...the progress bar is not working fine for me ...<BR/>i have apc extension installed and correct discribed on phpinfo.<BR/>can someone help me ?<BR/>thanks.jpcbarroshttps://www.blogger.com/profile/10423953388834021188noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-53832477594315110022008-08-20T07:27:00.000+02:002008-08-20T07:27:00.000+02:00After my tests, it seems:this progress bar cannot ...After my tests, it seems:<BR/><BR/>this progress bar cannot work with:<BR/>suhosin's patch.<BR/><BR/>and if php works as fastcgi - it cannot work too.<BR/><BR/>So if you are under (ubuntu 8.04) where php comes with suhosin already - you must rebuild witout suhosin.<BR/><BR/>I can help you with that. just email me at <BR/>huglester@gmail.com<BR/><BR/>good luck!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-11772325970415702572008-08-17T16:47:00.000+02:002008-08-17T16:47:00.000+02:00heya.anonymous with Ubuntu 8.04 , have you found t...heya.<BR/>anonymous with Ubuntu 8.04 , have you found the sollution?<BR/><BR/>I tried to recompile php without SUHOSINS patch - same problem as without removing it.<BR/><BR/>I see GET queries like:<BR/> http://192.168.1.107/apc/APCQuery.class.php?APC_PK[]=1.7168347417735283 <BR/><BR/>seems the file is being uploaded. <BR/>I tried to find where it places temp files, even while uplaoding I can't see temporary file. <BR/>Could anyone try to help me, finding it ? <BR/><BR/>and later, after file is uplaoded, i see this error:<BR/><BR/>data has no properties<BR/>[Break on this error] while(i < data.length){<BR/><BR/>anyone could be of any help?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-80069854361837941182008-08-15T09:39:00.000+02:002008-08-15T09:39:00.000+02:00Hello. and thanks for such nice tools.But in my en...Hello. and thanks for such nice tools.<BR/>But in my environment it doesn't work, I see get requests like: <BR/>GET http://aaa.com/APCQuery/APCQuery.class.php?APC_PK[]=1.7955122241208508 (31ms)jquery-1.2.1.js (line 2387)<BR/>GET http://aaa.com/APCQuery/APCQuery.class.php?APC_PK[]=1.7955122241208508 (16ms)jquery-1.2.1.js (line 2387)<BR/>GET http://aaa.com/APCQuery/APCQuery.class.php?APC_PK[]=1.7955122241208508 (31ms)jquery-1.2.1.js (line 2387)<BR/>GET <BR/><BR/>it seems like file is beeing uploaded, but lastly I get: <BR/><BR/>data has no properties<BR/>[Break on this error] while(i < data.length){<BR/><BR/>(those debuggin messages i got from Firebug)<BR/><BR/>apc.php shows that APC is running, and apc.rfc1867 is On .<BR/>I think the system can't handle tha ppaths. Because even while uploading , I can't find temporary files in php temp directory... strange<BR/><BR/>thanks in advanceAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-44138260517494964342008-07-06T16:35:00.000+02:002008-07-06T16:35:00.000+02:00Hi Andrea, thank your for your excellent script. I...Hi Andrea, thank your for your excellent script. I hope I may ask you for another advice: I need to write some data to a database after uploading the file, but since the upload.php is called internally it does not allow me to echo a message in case of success or failure. How would you handle that problem? Thanks, B.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-632550038168331862008-06-07T17:57:00.000+02:002008-06-07T17:57:00.000+02:00I've been using this script for several months now...I've been using this script for several months now, with great success. THANKS SO MUCH FOR IT! Now I'm trying to move my scripts over to a new machine, and I'm having the same problem Labenux is having. When the upload button is pressed, the upload button grays out, the progress bar box is displayed, but everything remains 0, no file is uploaded, and the page stops loading ("done").<BR/><BR/>It still works great on my old machine:<BR/>- Ubuntu 7.10 box, Apache/2.2.3 (Ubuntu) mod_python/3.2.10 Python/2.5.1 PHP/5.2.1 mod_ruby/1.2.6 Ruby/1.8.5(2006-08-25) mod_perl/2.0.2 Perl/v5.8.8<BR/><BR/>My new machine is running:<BR/>- Ubuntu 8.04, Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.1 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-09-24) mod_ssl/2.2.8 OpenSSL/0.9.8g<BR/><BR/>I've been working on this for more than a day now, and I can't readily find the difference, besides the newer versions. I have exhaustively compared the php.ini and apache2.conf files. Between the two servers, they are practically identical (a few comments differ. :/)<BR/><BR/>Any thoughts?<BR/>- Thanks!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-84299310982311199262008-05-13T21:05:00.000+02:002008-05-13T21:05:00.000+02:00Your code looks nice, without testing anything yet...Your code looks nice, without testing anything yet. However, I'm not familiar with APC but as far as I can see you are only using it to once? apc_fetch() from the class file. Now I was wondering, to avoid the hassle of installing APC, wouldn't it work fine by saving the id in session $_SESSION?<BR/><BR/>Thanks.Unknownhttps://www.blogger.com/profile/00296599297230996443noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-76897792356234406462008-03-22T20:12:00.000+01:002008-03-22T20:12:00.000+01:00Hey,, i've got to say, you wrote one hell of a scr...Hey,, i've got to say, you wrote one hell of a script.. very nice..<BR/><BR/>but i'm having this problem.. i'm not so good in Java.. so your help is highly appreciated :)<BR/><BR/>//--------------><BR/>Webpage Script Errors<BR/><BR/>User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0;)<BR/>Timestamp: Sat, 22 Mar 2008 18:46:17 UTC<BR/><BR/>0.<BR/>Message: 'length' is null or not an object<BR/>Line: 85<BR/>Char: 3<BR/>Code: 0<BR/>URI: http://localhost/upss/<BR/><BR/>Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5<BR/>//<----------<BR/><BR/>Help pleaseAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-22540485975214976492008-03-17T14:15:00.000+01:002008-03-17T14:15:00.000+01:00Cheers! To be honest, I did not think about that k...Cheers! To be honest, I did not think about that kind of different configuration ... and I cannot understand the reason but anyway, your solution is really welcome ;)<BR/><BR/>Kind RegardsAndrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-53549086178535313662008-03-17T13:06:00.000+01:002008-03-17T13:06:00.000+01:00I've found a particularly problematic line of code...I've found a particularly problematic line of code in the APCQuery.class.php file. I was getting the same problem as labanux, where nothing was showing up in the Upload section, and the upload didn't do anything.<BR/><BR/>On line 45 of APCQuery.class.php, you have:<BR/> <BR/>if($_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF'] === str_replace('\\', '/', __FILE__)){<BR/><BR/>I found that my Windows server's DOCUMENT_ROOT variable was different - it had '\' characters instead of '/', which was making the 'if' statement fail, and therefore do nothing! I replaced mine to this:<BR/><BR/>if(str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF']) === str_replace('\\', '/', __FILE__)){<BR/><BR/>I think this might even be safe to remove (or replaced with another check).<BR/><BR/>This took me literally hours to find, so I hope this helps!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-54970147189637132002008-02-26T04:37:00.000+01:002008-02-26T04:37:00.000+01:00I've been searching for around an hour looking for...I've been searching for around an hour looking for a nice PHP/JavaScript solution that shows your upload progress, then I stumbled upon your site... Very well done! I think if you commented your code a little more, it may help people who need to alter the standard mechanism of the code.<BR/><BR/>I may need some more help when I implement this into a site I'm working on, but again - you've done a good job!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-63460839737826144562008-01-30T18:07:00.000+01:002008-01-30T18:07:00.000+01:00Italian language, sorry...SORRY?!?!?! What do u me...Italian language, sorry...<BR/><BR/>SORRY?!?!?! What do u mean... Sorry...<BR/><BR/>:-(<BR/><BR/>DavideAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-22104021373902145232007-12-12T17:46:00.000+01:002007-12-12T17:46:00.000+01:00Hello and thank you very much for this tutorial, i...Hello and thank you very much for this tutorial, it works perfectly for me. But for now i'd like to pass the value of an input field (text input) from the upload form page to the upload.php. Àny idea ?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-30157016762963217282007-12-03T17:54:00.000+01:002007-12-03T17:54:00.000+01:00As I said before, i've tried other Ajax Uploader w...As I said before, i've tried other Ajax Uploader with APC - script. And it works well.. <BR/><BR/>These are software version that I use : Apache/2.2.4 (Unix) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8d PHP/5.2.1 mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 Perl/v5.8.7<BR/><BR/>The APC version is 3.0.15<BR/><BR/>*I'm using Debian Linux, btw..<BR/><BR/>Should I made any changes to your script before I can use it?<BR/><BR/>NB: The script that I use is located here http://progphp.com/progress.php (if i'm not wrong it was made by Rasmus itself).<BR/><BR/>Any clue?Unknownhttps://www.blogger.com/profile/16733116413117588211noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-45730025860123035092007-12-02T18:33:00.000+01:002007-12-02T18:33:00.000+01:00labanux You should tell me wich version of PHP You...labanux You should tell me wich version of PHP You have in your server.<BR/><BR/>My example simply works for everyone but not for You so I think the problem should be the PHP version or your specific configuration, isn't it?Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-5411400463886645382007-12-02T04:22:00.000+01:002007-12-02T04:22:00.000+01:00I've download APCQuery, and installed it on my loc...I've download APCQuery, and installed it on my local server.<BR/><BR/>But it didn't work as it should..<BR/><BR/>I browse the file, then click the upload button. Then the upload progress showed up. But the upload progress information never updated.<BR/><BR/>It just show Total, sent, and rate : 0 bytes. Meanwhile the progress bar never showed up.<BR/><BR/>And afther clicked the upload button, the upload button itself disabled forever..<BR/><BR/>Any suggestion?<BR/><BR/>NB: I've installed APC, and it works. Cause i've tried using other uploader script, and it works well.Unknownhttps://www.blogger.com/profile/16733116413117588211noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-7701562112508879372007-12-01T10:43:00.000+01:002007-12-01T10:43:00.000+01:00Oops, thank You :-)Oops, thank You :-)Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-84827065259277644292007-11-30T23:23:00.000+01:002007-11-30T23:23:00.000+01:00Hi you have an syntax error.its working fine with ...Hi <BR/>you have an syntax error.<BR/>its working fine with your example of the demo but whene im using it in drupla its does not fined the file input in the form.<BR/>filter("[type=file]") when you need to do filter("[@type=file")<BR/><BR/>i hope i helped someone...Unknownhttps://www.blogger.com/profile/18340721933832131774noreply@blogger.com