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.


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to