Re: Help with file upload

From: Date: Thu, 16 Oct 2003 06:31:31 +0000
Subject: Re: Help with file upload
References: 1 2 3 4 5  Groups: php.db 
Request: Send a blank email to php-db+get-31050@lists.php.net to get a copy of this message
I used this code now: if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
    move_uploaded_file($_FILES['ufile1']['tmp_name'],'./' .
$_FILES['ufile1']['name']); This is the reply I got: Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream: Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line 6 Warning: move_uploaded_file(): Unable to move '/tmp/phpfJyDSw' to './ayservenet.jpg' in /home/ayserve/public_html/fu/fuprocess.php on line 6 ayservenet.jpg DONE Array ( [ufile1] => Array ( [name] => ayservenet.jpg [type] => image/pjpeg [tmp_name] => /tmp/phpfJyDSw [error] => 0 [size] => 3030 ) ) I had experienced this also on Windows IIS now it is also coming on my Linux yet I have full access to the two servers. Bunmi John W. Holmes wrote:
Bunmi Akinmboni wrote:
His is the new code: <?php if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
    copy($_FILES['ufile1']['tmp_name'], ".");
You should be using move_uploaded_file() instead of copy(), first of all. Next, the two arguments passed to either copy() or move_uploaded_file() are _filenames_, not directories. So something like move_uploaded_file($_FILES['ufile1']['tmp_name'],'./' . $_FILES['ufile1']['name']); is probably what you're after.


« previous php.db (#31050) next »