Blog of The SJG

Wednesday, February 07, 2007

PHP/AJAX file upload with progress bar, part 4

Now with a super crufty AJAX'ified interface! See it here.

Update: Source code has been added to my hacks repository on github, get it here: http://github.com/evilsjg/hacks/tree/master/fileupload

12 Comments:

  • any sources of upload.php?
    michal86-at-gmail-dot-com

    By Anonymous Anonymous, at 5:26 PM  

  • http://evilprojects.net/hacks/browser/fileupload/branches/head

    Everything is there.

    By Blogger sjg, at 10:53 PM  

  • Superb!

    Took a while to make it work, now im just wondering if im allowed to use it.
    Just cant find a lisence or copyright notice anywhere

    By Blogger William, at 1:36 AM  

  • William,

    You may use it under the terms of a 2-clause BSD license, I have updated the source to reflect this.

    By Blogger sjg, at 5:44 AM  

  • Thats the kind of license i was hoping for. Thanks.
    There are a few things that need change but as you said in http://evilcode.net/sjg/blog/2007/02/phpajax-file-upload-with-progress-bar.html
    that you consider it alpha so i take it its not finished yet.
    Anyway, for those that dont have the option to use php 5.2 and install the required plugin this really is a magnificent piece of software.

    ps. you forgot to comment the copyright :)

    By Blogger William, at 5:59 AM  

  • William,

    Woops, added comments. I'm not really using this code at the moment, but I am more than happy to accept patches for the sake of posterity.

    Thanks for the kind words, I'm glad you've found this useful.

    By Blogger sjg, at 6:13 AM  

  • This thing doesn't work in safari...

    By Blogger Unknown, at 1:46 PM  

  • i have an older version of php (something in the php4 family) on a shared hosting plan for which i cannot access or update the software, so this looks like an uploader that would work in my situation. i looked for the source at the original path you published (http://evilprojects.net/hacks/browser/fileupload/branches/head) but the files are no longer available. Could you re-post? Thanks!

    By Anonymous Anonymous, at 12:59 PM  

  • This is an excellent piece of software and from looking at your demo page this does just what I need.

    However, I'm having trouble getting this to work. The problem seems to be that upload.php is not receiving the port number via the pipe to ajax-update.php. If I run ajax-update.php from the Unix command line it returns a port number on stdout fine.

    Can you make any suggestions about how to install the software? Any special configuration needed on Apache? I'm running Apache 2.054 and PHP 5.04 on Fedora Core.

    Any help much appreciated.

    By Anonymous Anonymous, at 4:05 AM  

  • Well I finally got the code working yesterday. For some reason on my system three lines of information are returned by ajax-upload.php. The first two appear to be blank lines (need to investigate) and the third one contains the port number.

    Because there is only a single fgets() in upload.php it retrieves one of the blank lines rather than the port number from the pipe. I added two more fgets() calls and hey presto it works...well sort of.

    With a large upload (15Mb) the status bar gives up at random intertvals (once at 37% another time at 76%) but the upload actually completes successfully.

    I will post with more info when I have it.

    By Anonymous Anonymous, at 10:21 PM  

  • Well I now have everything working. I can't explain the cause of the strange behaviour I reported before and I could not find any reason. In the end I downloaded all the files again from your repository and it just worked. I must have corrupted one of the files when I uploaded it to my server that is all I can think of.

    Anyway apologies for the false alarm and thanks for designing such a superb solution for PHP file upload progress monitoring.

    By Anonymous Anonymous, at 12:55 AM  

  • Hi
    The page is no longer available to download the source files. Any chance of posting another link?
    Best Regards

    By Anonymous Anonymous, at 4:01 AM  

Post a Comment

<< Home