I'm currently looking to see if I can enable rfc1756 (APC) support into filefield to get upload progress information (% or amount of kB/MB uploaded)
the rfc lists a 13 old experimental protocol... why would you want that? what else implements it?
The possibility of having an uploadprogress bar for large files (eg videos) without the need for flash or other 3rd party protocols.
Lots of users hit the stop or reload button when they are uploading large files because the current progress or throbber style (ahah) doesn't give them any feedback about the upload status. If they would see (5%->6%->7%) they would for sure wait till the end.
Now, with normal php you can't get any feedback from the server about the upload status, with APC (and rfc1867 (http://pecl.php.net/package/APC)) enabled you can. If we find a way to add some optional js (ajax, ahah) when APC is installed and enabled, to pull the upload variable info from the server and update the bar with setProgress, I think this would be a great feature for filefields.
now... Looks like I first have to fix another problem with APC and rfc1867: when rfc1867 is enabled in the apc configuration, I get WSOD (white screen of death) after submitting forms WITH a file input field... For filefield this results in empty file boxes and submitting the node with the filefield fields results in getting an empty node form again...
You are quite correct trogie... I would love support for the upload progress feature.. A not on api and file upload progress... Be wary of the order you put those special inputs in... :) You'll need to make some changes to the JS to detect if the APC inputs are rendered and add code to the form to create the apc inputs.
Damien Tournoud has a really good stab at this in #389150: Display upload progress (when possible).
Here's a patch that actually mostly works! :)
To get working:
- You need APC on your PHP installation
- You need to set apc.rfc1867 = 1 in your php.ini file (.htaccess might also work, ini_set() does not work).
- Apply the patch
apc.rfc1867 = 1
What doesn't work:
- It only works on one upload at a time. If you try to upload two things at once, the uploads complete but only the first progress bar works. This seems to be a limitation of the APC progress mechanism. Sad panda.
Here's an improved patch which makes the PECL extension "uploadprogress" the default if available, as it seems to support multiple uploads much better than APC. It also adds a hook_requirements() to report which upload progress method (if any) is available.
works for me.
- I had to checkout DRUPAL-6--3-0-BETA2 in order for the patch to apply.
- I am using the uploadprogress pecl extension.
- Works cleanly and as expected. great work.
- Uploading: http://skitch.com/zroger/bke3i/create-page-drupal6.rdlopez.com
- Post-upload: http://skitch.com/zroger/bke39/create-page-drupal6.rdlopez.com
- Status report showing requirements: http://skitch.com/zroger/bke4f/status-report-drupal6.rdlopez.com
- phpinfo, uploadprogress section: http://skitch.com/zroger/bke48/phpinfo
Thanks Roger! I didn't think this was going to get reviewed and I was thinking of saving it for the 3.1 version. Maybe it'll make it into 3.0 now. :-)
I've been thinking that maybe not all FileFields should have this option though, what do you think about making it a configurable option?
[ x ] Enable progress bar
It'd also be helpful to make this option visible to all users as a disabled checkbox if their system does not support it, then link to documentation on how to get it working in the description.
I'm not so sure about the configuration option. I liked the fact that with this patch, if my system supports upload progress, all I had to do was add the field. No extra configuration. No extra thought. It just worked.
I think you have a very intelligent and unobtrusive way of implementing this. It's as if it always worked this way. Furthermore, we don't have an interface option for ajax uploading, just the concept of progressive enhancement. In my mind, that's all this is.
Well, we can always add an option later. I just like the throbber better because it doesn't take up any extra space on the page, but in practical usage I think the progress bar will be more helpful. Not to mention it's just really cool. :-)
Committed so it'll be in the 3.0 release.
Is this in 3.0-RC1? (I tried applying the patch but too many hunk failures to have hope)
If no, then can you recommend a stable revision# from dev?
BTW, I stumbled into this thread because I have issues with FF only checking the file size and extension AFTER the file is uploaded. For us, since we're typically handling data projects to the tune of tens of GB (cutting the files up into ~500MB chunks), uploading an 800GB file results in a wait...wait...wait... error!
Also, we're using private SSL certificates inside of server SSL, so a POST gets sent to Apache and fully buffered before PHP sees anything (one reason we're limiting files to 500MB). This may make it difficult for the progress bar to work, or (my next question) pre-uploading file-size checking. Here's an example of somebody using JS to check size/ext before upload --> #320701: Use JS to validate file extensions before uploading
So, I'm curious if you think the progress bar won't work in a private SSL + server-cert environment, and if you have any recommendation on pre-upload checks.
As far as I know, pre-upload checks are not possible in modern browsers (IE6 has some ActiveX control of course, but security issues caused that to be removed in current IE versions afaik). The issue you linked to is only for extension checking, which is already in FileField.
The upload progress feature is not in RC1, but you can download the development version and try it out from there. Since we haven't had any show stoppers in RC1 (other than users that don't upgrade correctly), I expect that the final version will be out next week, so you could just wait for that.
That said though, this implementation still doesn't prevent the complete file from being uploaded before the validation fires. It's certainly possible to add this check, since now we know the file size during the upload. However that should be addressed in a new issue. This issue simply added the progress bar, it didn't introduce new validation or changes to the way FileField saves the data.
I want to mention that I tried to manually patch filefield.module, filefield.install, etc., but then all my filefield fields in all my content-types disappeared.
(I don't think I have the PECL extension -- in phpinfo I see: PECL Module version 1.0.1 $Id: pdo_sqlite.c,v 126.96.36.199.2.3 2007/12/31 07:20:10 sebastian Exp $, and
having read the "PECL extension 'uploadprogress' the default if available" blurb by Roger I felt daunted by compiling PECL with other dependencies. (I'm also using utterramblings repo for PHP due to having upgraded to 5.2 to support a bunch of Drupal modules on RHEL5). Is there a simpler way to add PECL support?)
Anyway, after patching, I reinstalled filefield via Development module. I did this because just after patching I didn't see any check box on the field configure screen, and since one of your patches was on filefield.install, I assumed that something needs to happen during install such as mods to db tables, etc. (I did NOT reinstall FF when I upped from 3.0-alpha7 to RC1).
I plan to restore my sandbox's DB and pre-patch files, and try again.
So, are the missing fields in CT's expected after performing a filefild reinstall? Should I not have done that? Any other recommendations for either manually patching upload-progress-bar into rc1 or when 3.0-final comes out?
I'd suggest not patching at all and just download the development version. You're mixing support requests into this issue. Please open a new request for help, this thread is about implementing the feature, not about getting it working on RHEL.
wait - does that mean this functionality has been committed to the development version of filefield? Neat!
I'm trying out the FF progress bar, so I've popped in 3.x-dev, but I don't see the bar or any checkbox to enable it. I've looked on the Modules enable page, and in the field configure screen. (and added PECL extension) Where is it? Thanks.
Check your status page (admin/reports/status) and see what the "Upload progress" item says. If it's green, then the PECL extension is installed properly and FileField will use it automatically.
PECL Uploadprogress sounds good, but there is one problem that you have not thought.
What happens when PECL Uploadprogress is installed and it is not an apache webserver?
the upload fails!
An HTTP error 404 occurred. /filefield/progress/a8989ffa6226356644edc7246c704799
I use lighttpd and the new dev of filefiels breaks all filefields.
There must be a server check that the apache is used as webserver or checkbox to (de-)activate the uploadprogress.
Lighttp 1.4 has no support if pecl uploadprogress
lighttpd 1.5 has it, but it is not stable and a stable relase is far away.
I do not know the support of uploadprogress on other webserver like nginx or other, but you should be some checks, an advice and a help in the readme.txt or install.txt
changing status to needs work
Please open a new issue for this problem, since this patch has already been committed.
See #437254: Upload progress does not work in Lighttpd & nginx
Automatically closed -- issue fixed for 2 weeks with no activity.
You can't set apc.rfc1867 on .htaccess (as stated in http://ie.php.net/configuration.changes) because it's a PHP_INI_SYSTEM (http://us2.php.net/manual/en/apc.configuration.php) type directive.
This issue has no child issues.
Drupal is a registered trademark of Dries Buytaert.