October 18th, 2002, 06:44 PM
mkdir() and ftp
i've had this problem before but never seem to get it solved. bascially i have a system that creates a folder on my server and can upload files to it. the folder is created like so...
mkdir ("../../works/$work_id", 0777);
where $work_id is a unique number hence always creating a unique folder. this all works fine but from time to time i need to go to the folder via ftp to modify things. i seem to be able to delete files via ftp but not download files? i suspect my problem is the 0777 but am not sure?
October 19th, 2002, 07:12 AM
Deleting files requires write permissions in the directory, which you have. But I assume the files in there are created by your script, so they will be owned by whatever user your scripts run as, eg. httpd, or www. Maybe you would have to modify your script to change the permissions or ownership of the files when they're created?
October 19th, 2002, 09:45 AM
yes correct its an upload script on the site which puts the files in the directory and on checking again it seems the permission problem is on the file not the directory, the files are uploaded like so...
$address = "../../works/".$work_id."/".$file_name;
move_uploaded_file($file, $address) or die("problem");
$work_id is the unique number of the folder, $file_name the name of the file and $file obviously the file, so how do i upload the file with the correct permissions?
October 19th, 2002, 11:22 AM
should allow you to download the file. if you want to write over it, chmod to 0666 instead.
October 19th, 2002, 02:48 PM
yep i'm using 0777 now which seems to work fine for uploading downloading and deleting the file via ftp, still can't change the permissions on the file via ftp though!