|
Posted by Janwillem Borleffs on 10/11/87 11:53
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]
|