RE: [PEAR-DEV] pear Uploader class issues
| From: | Sam Liddicott | Date: | Thu, 23 May 2002 07:57:57 +0000 |
| Subject: | RE: [PEAR-DEV] pear Uploader class issues | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-6353@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: daniel [mailto:daniel@electroteque.org]
> Sent: 23 May 2002 01:46
> To: pear-dev@lists.php.net
> Subject: [PEAR-DEV] pear Uploader class issues
>
>
> hi i have some issues with the pear uploader class i'm trying to get
> specific error id's out of the script using
> $file->getProp('error') unfortunatly its not showing up or is
> returning null
> , how is it possible to get the errors out, i'll like to find
> which error it
> is and if its a FILE_EXISTS error i'd like to show a confirm
> box saying
> overwrite file and if click yes change the value of $dest_name =
> $file->moveTo($dest_dir,'false'); to true , how is this possible ?
I don't think you can achieve what you want to without making the user
upload the file twice in such cases.
If you want to warn the user about clashing filenames you would be better to
first copy the file to a unique name (perhaps on the target filesystem) to
preserve the upload. Then try and rename the file to the desired target
name.
If the target file already exists then return a form to the user which asks
the confirmation "Overwrite" question. This form will also contain as a
hidden field the unique-renamed name, and the desired target name. When
this form is submitted to a 3rd page it will peform the rename of the
previously uploaded file.
Sam