You are here: Re: PHP file upload « PHP Programming Language « IT news, forums, messages
Re: PHP file upload

Posted by Rik on 01/19/07 13:10

rfhurley wrote:
> move_uploaded_file($_FILES["file"]["tmp_name"],
> "upload/" . $_FILES["file"]["name"]);

> the problem is, that I can't find my file "red.jpg", or
> "upload/red.jpg"-- or even a folder marked "upload/"-- anywhere on my
> server. Am I missing something? (well, <i>obviously...</i>)

Yes, you should:
1. Create a directory to which you want to move the uploaded files.
2. Chmod this to 0766 (or 0777).
3.
move_uploaded_file($_FILES["file"]["tmp_name"],'/the/path/you/chose/'.$_FIL
ES["file"]["name"]);

Also, temporarily enable error reporting (do not do this on a live
environment..) so you can see it if move_uploaded_file fails and how.
<?php
ini_set('display_errors',true);
error_reporting(E_ALL);
?>

(possibly to error_reporting(E_ALL|E_STRICT); if you're in the mood for
cleaning bad habits in code.)
--
Rik Wasmus

 

Navigation:

[Reply to this 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

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