Wednesday
4
February
2009

It’s Update Time…

No task update since 3 weeks ? That can not be true. :-)

And you’re right… Of course there are several news, but they were too small to write a own entry. Therefor I will give you now a update of what has been done since 14.January.

File uploads:

  • Several people noted that they get an exception when they use the file element. And they noted that they is no filled $_FILES array in this case.

    The reason is simple: When the uploader exceeds the size definition from the php.ini file then the file is not accepted by PHP. As there is no file, PHP deleted it, the file element returns an error.

    The solution for this problem is of course also simple: Let’s use the web-browser to do this check for us. When you set the maximum filesize setMaxFileSize() then the browser checks if the file which should be uploaded exceeds this size.

    $fileelement->setFileSize(100000);

    Within the next release this size check is automatically set by using the maximum values from the PHP.ini file.

  • 2 new methods have been added:
    getFileSize() returns the real size from the uploaded file. It does not rely on the informations of the $_FILES array.

    getMimeType() returns the real mimetype of the uploaded file. It uses the fileinfo extension or the mime extension for detection.

  • All methods have now support for multifiles: Several methods lacked the support like getErrors, setFilters and some others.

    If you expect problems with multifiles you should use ZF1.8 and higher or trunk.

  • getFileName() supports now also path reduction by it’s second parameter.

    This feature was added for all lacy ones which don’t want to use the getValue() method. ;-)

  • Several people noted in the past that the file element does not work due to false usage of setDecorator at the elements.

    As note: setDecorator() deletes all default decorators. But the file decorator is responsible for the hidden elements needed for file uploads to work properly and also for the correct naming schema.

    As solution to this problem I added a marker interface for the file element. This means as soon as you missuse setDecorator() and forget to add the file decorator before rendering it, an exception will be thrown.

  • In past, when the upload was processed, the file was first moved to the set destination (or the temporary directory), and after that the file was renamed according to the used rename() filter.

    As you can see, in this case, the file is moved twice. Once into the temp directory and then to it’s renamed location. The bigger the file, the more ressource intensive is this task.

    As solution I added a new behaviour: When a rename filter is added, then the destination from this filter is instantly used as moved location instead of moving the file twice.

  • Rob mentioned in his blog that the file element does not really work with the count validator. Specially when using multifiles.

    This really hard to solve bug was finally fixed… now the count validator works on normal file elements, multifiles and also multiple file elements as expected.

Localization informations:

  • I added new informations which can be requested using Zend_Locale’s getTranslationList() methods.
    You can now request 3 digit country codes and also 3 character country codes. These codes are often used within enterprise systems (f.e. banks).

Date detection:

  • I increased the date detection routines. They can now automatically handle 2 digit year notations like 120209 even when you give no format, or a false format. This has an positive effect on the date validator and also to the isDate method.

All above mentioned features are only available in trunk and will be released with ZF 1.8.

Additionally I have already some new features on hold. But they are still under review by the dev-team. So I will inform you as soon as they are cored. And I also added some new proposals, 5 in sum, which are eighter under review or under recommendation.

So I wish you a happy frameworking :-)

Greetings
Thomas Weidner
I18N Team Leader, Zend Framework

Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework

Back to top