Uploading a file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
franky_1
Forum Newbie
Posts: 4
Joined: Wed Apr 16, 2003 6:35 am
Location: South Africa

Uploading a file

Post by franky_1 »

Hi there

I'm new to PHP, and I'm trying to upload a file
but everytime I try I get the following error message :
Warning: Unable to create '/usr/www/users/weblet/fmtest/uploads/Ckinfo.txt': Permission denied in /usr/www/users/weblet/fmtest/upload_go.php on line 18

Warning: Unable to move '/tmp/phpyZaS22' to '/usr/www/users/weblet/fmtest/uploads/Ckinfo.txt' in /usr/www/users/weblet/fmtest/upload_go.php on line 18
Possible file upload attack! Heres some more info:
Array
(
[userfile] => Array
(
[name] => Ckinfo.txt
[type] => text/plain
[tmp_name] => /tmp/phpyZaS22
[error] => 0
[size] => 1392
)

)
Line 18 is

Code: Select all

<?php
move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir.$_FILES['userfile']['name']))
?>
The directory I'm uploading does exist, so if anyone can help me or point me in the right direction I would very thankful.
franky_1
Forum Newbie
Posts: 4
Joined: Wed Apr 16, 2003 6:35 am
Location: South Africa

Almost forgot

Post by franky_1 »

my uploaddir is

Code: Select all

<?php
$uploaddir = "/usr/www/users/weblet/fmtest/uploads/";

?>
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

What is your chmod perms on that directory? You need to have read/write in order to upload to it.
franky_1
Forum Newbie
Posts: 4
Joined: Wed Apr 16, 2003 6:35 am
Location: South Africa

Post by franky_1 »

hi

I have no idea. How can I find out, and more importantly how do I set it and what must I set it to. :?
Jim
Forum Contributor
Posts: 238
Joined: Fri Apr 19, 2002 5:26 am
Location: Near Austin, Texas

Post by Jim »

If you use a unix server and an FTP program like Cute FTP, Smart FTP or WSFTP Pro, right click on the file or directory you want to CHMOD, scroll down to "CHMOD" on the list you'll get, and change the number in the little box to either "775" or "777."
franky_1
Forum Newbie
Posts: 4
Joined: Wed Apr 16, 2003 6:35 am
Location: South Africa

COOL!!!!

Post by franky_1 »

It works fine, and thanks fir the help :D
Post Reply