Flash upload system
February 22, 2008 11:29 am Flash, Programming, ade's stuffI’ve started work on a new Flash/PHP web upload system… to make sharing files easier when MSN is too slow or when i’m at school/work and want to send something straight home (without having to re-download it when I get home)
i’ve thought of some stuff i want to make but i started out with the most important feature, uploading files. i looked around on the web for a suitable solution matching my criteria,
- be able to show percentage progress bar
- show upload speed
- be reasonably compatible
turns out it’s a pain making a progress bar with AJAX & PHP. while certainly possible, apparently requires a recompiling php with a patch and stuff, and that’s going to create problems in the long run. however, you can do it in flash pretty easily. now, not all systems have a flash player, but that’s likely to change. this also allows for some funky animations and stuff
so, building on the source from the papervision logo i made earlier, i extended my cube class and converted it to a plane, with texturing. then i chopped up a default file icon from vista in parts of 16×16 pixels (with actionscript code) and assigned them to a grid of 11×14 planes. i also added the target rotation angles instead of just target coordinates. as the file upload progresses, planes come out from the lower left corner and build up the file icon. so it’s like a progressbar (but way cooler)…
oh, and the back end on the server is just a simple php script that eats the transferred file and puts it in the right place. btw, i had to mod the php config a bit to make it accept files larger than 2mb, and run for longer than 30sec. the current system has been tested and works with 700mb+ files.
i won’t post the real thing here because i dont want my server clogged with random files, but here’s a demo of how it looks with the uploading code removed.
again, this is made with Flash CS3 + the papervision3d lib.
click it to start it or reset progress!
