Brad Daily wrote:
> (PHP 5.1.6, Apache 1.3, Cake 1.1.8.3544)
>
> We are in the process of porting an existing PHP app to cake, and have
> ran into an odd problem with file uploads (for images) using Flash 8.
> The image appears to upload correctly, to the correct directory, but
> when you try to open the file, it is corrupted. The really strange part
> is that after the upload is finished, we automatically create a
> thumbnail of the image with GD and that file is perfectly fine.
>
> The upload is handled in the controller via:
>
> move_uploaded_file($this->params['form']['Filedata']['tmp_name'],
> $destination_dir);
>
> The flash code is the same code we used in the original PHP project, so
> I don't think it is causing the issue. I'm hoping someone else has ran
> into this and can give some insight...

is $destination_dir a full path of the newly uploaded file or just
destination directory name where you expect the file to be saved?

if it is a directory name then the files probably keep their tmp_names
which might cause apache to set wrong response headers.

i'd try somehing like

move_uploaded_file($this->params['form']['Filedata']['tmp_name'],
$destination_dir .
basename($this->params['form']['Filedata']['name']));

this way you will keep original file names with proper extensions.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to