|
Posted by Techris on 10/11/71 11:53
Thank you very much.
"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:44c1c37c$0$9250$dbd4d001@news.euronet.nl...
> Techris wrote:
>> function uploadpic($pic){
>> foreach($pic as $value){
>> copy ($_FILES['$value']['tmp_name'], $_FILES['$value']['name'])
>> or die ("Could not copy");
>>
>
> Two things are going wrong here:
> - Use of copy() instead of move_uploaded_file() (see manual);
> - Use of single quotes, causing the string '$value' to be parsed as a
> literal.
>
> Correct usage:
>
> move_uploaded_file($_FILES[$value]['tmp_name'],
> "/targetdir/{$_FILES[$value]['name']}");
>
> *or*
>
> move_uploaded_file($_FILES["$value"]['tmp_name'],
> "/targetdir/{$_FILES["$value"]['name']}");
>
> Mind that /targetdir/ must be writeable for the www user (e.g., by
> chmodding it to 777).
>
>
>
> JW
>
Navigation:
[Reply to this message]
|