Reply to Re: copy function Q

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация