Installing PECL uploadprogress Extension for Drupal FileField 3.0 Module
FileField and ImageField 3.0 have just been released and bring with them the ability to display an upload progress meter in the FileField widget while a file is being uploaded. As ImageField uses the FileField widget this works for ImageFields too.
The original article FileField and ImageField 3.0 for Drupal 6 Released points out:
Probably the most exciting improvement is the addition of upload progress indication. This enhancement requires the PECL uploadprogress PHP extension, but adds a real asset to sites that use FileField for podcasts, videos, or other large files.
It took me a while to figure out how to install this extension so I thought I'd do a quick post about it. These instructions are probably valid for other PECL extensions but since this is the only one I have installed I wouldn't like to say for sure.
pecl install uploadprogress
Download the PECL uploadprogress extension
Extract the uploadprogress-1.x.x.tgz archive, cd into the extracted folder and run these commands in Terminal:phpize # prepares the PHP extension for compiling
sudo make install
Check that the directory for the extensions is correct. The last line of the output returned from the
make installcommand (on my system) is:Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20060613/
Open php.ini and edit the
extension_dir directive, replacing it with this path.
- Add the extension to php.ini by adding this line
- Restart apache
You should now have the PECL uploadprogress extension installed.
It's very simple to install on Windows:
- Copy the uploadprogress.dll file from pecl4win into the path set for
- Add the following to php.ini:
- Restart apache.
If you're using using WampServer 2 then it already comes with php_uploadprogress.dll installed (thanks again to chriscohen for pointing this out and testing that both methods work).
To increase the maximum filesize you need to set 2 directives:
- upload_max_filesize - Maximum allowed size for uploaded files.
- post_max_size - Maximum size of POST data that PHP will accept.
Generally you should set
post_max_size to double what you set
upload_max_filesize to. This means you can upload 2 files of your maximum limit for each POST and seems like a good middle ground.
memory_limit directive should also be set above the value of
post_max_size so your server can handle the uploads.
There are 2 ways you can set this directive:
Edit php.ini and modify these directives:
post_max_size = 256M
Edit .htaccess and add:
php_value post_max_size 256M
Adjust 128M and 256M with the sizes you require.
You could edit the
memory_limit directive in php.ini but I personally like to set that directive on a site-by-site basis. This helps to keep sites that don't need such a large
memory_limit nice and efficient.
Instead you can set the directive in settings.php by adding this line just below the other
2 years 36 weeks ago
2 years 44 weeks ago
3 years 47 weeks ago
5 years 19 weeks ago
5 years 50 weeks ago
6 years 11 weeks ago
6 years 11 weeks ago
6 years 12 weeks ago
Drupal Developer Reference
DrupalContrib API was created by Freestyle Systems for Drupal developers who need access to reference documentation for Drupal's most popular contributed modules.
If you're a Drupal developer you'll no doubt find our resource invaluable!