Forum Moderators: coopster
This is what I would like: a file upload script with a progress bar and that can handle all sort of issues, such as duplicate file name, illegal file extensions etc.
In my desperation I have tried almost every script I have bumped into the last couple of years, including commercial ones.
I have used uberuploader for a while, where the progress bar is not showing, so displaying an animated gif instead. not good... I've also tried FancyUpload which only works partly... not sure what the problem is there.
How have you people solved this?
Do you have alternative suggestions, or do you perhaps know what could be the problem with uploadify and fancyupload on my vista?
- Percentage is easy. Total file size / amount received. The problem is in, "what's the total file size?"
- You cannot access the initial file upload size because browsers disallow any Javascript manipulation of the object. If you could, it would be a **major** security hole, allowing abuse of the file upload object to sniff the user's system.
- You have to move this file to the server, and that is the only place you can control the received file. But how can you know what the TOTAL file size is before it arrives?
You can't.
The closest I ever got was using fork() to fork the upload in a child process, inserting a small iframe in the upload page that checked the process ID of the upload and was able to report total bytes uploaded. But as a "progress meter" it was a huge waste of time without knowing the full file size.
Most of the progress meters out there are "fluff and mirrors" and have nothing to do with actual file upload progress. They are configurable, meaning, extend or shorten the length of time allowed for upload. So what you'd do is "fake it" by futzing around with this until it gets close.
Then you send it to the client who has a different connection speed and it all falls down.
But there is a "workaround."
Throw a small animation on the page "uploading, please wait . . . " Put it in a hidden div.
On submit of the form for upload, show the div using Javascript. So it will sit there and animate, giving the impression it's in the works - and is a far cry more "honest" than fiddling about with a fluff meter.
When the upload completes, your script returns a success response, replacing the upload page and returning the form for upload another (or whatever.) This re-hides the uploading div.
I've been watching the PHP progress meter issue too, and wonder just how in the hell they are going to pull that off. Would be great if they can.
You can leverage APC or uploadprogress PECL extensions.
An important note to any upload tracking is you want to ensure that you are not in a current session. One way to ensure that your not writing to the session is to call: session_write_close(); at the beginning of your script.
As has been stated flash uploads are probably your best bet via your shared situation.
Good Luck,
JC
I have successfully gotten it to work with Zend_ProgressBar utilizing the JSPull adapter and the uploadprogress PECL extension.
I am working on a write up for it now talking about multiple files and how it works. There are several tutorials out there for uploading a single file.
If you would like I will PM you with a link when the article is complete.
Cheers.