Re: [Quickform.php] Deletion of the files in function validate()

From: Date: Mon, 07 Apr 2003 12:19:56 +0000
Subject: Re: [Quickform.php] Deletion of the files in function validate()
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-14973@lists.php.net to get a copy of this message
<frederic.poeydomenge@free.fr> wrote : > In the validate() function, in Quickform.php, the isset($file['tmp_name']) > instruction always returns true, even if no file was uploaded : > > myfile Array(4) > + name String[0] () > | type String[24] (application/octet-stream) > | tmp_name String[4] (none) > + size Long (0) > > that produces an alert when trying to unlink the file 'none' (Unlink failed > (No > such file or directory) in /usr/share/pear/HTML/QuickForm.php on line 1636) > > Is this part of code necessary, as PHP is already implementing the mecanism to > delete uploaded files at the end of the request (PHP Manual, Chapter 18. > Handling file uploads) : > "The file will be deleted from the temporary directory at the end of the > request if it has not been moved away or renamed." > > And since PHP 4.2.0, PHP returns an appropriate error code along with the file > array, so if this part of code is necessary, the test should be modified : > > if ( > (isset($file['error']) and $file['error'] == UPLOAD_ERR_OK) > or > (isset($file['tmp_name']) and $file['tmp_name'] != 'none') > ) { Hi Frederic, Thanks for the report, I'll add that to the todo list for the next release. Bertrand Mansion Mamasam

« previous php.pear.dev (#14973) next »