I'm wondering if there's a way to upload files with an HTML form without having to make the directory I'm uploading to writable (777, 757, etc). I've read the file uploading tutorial/article at PHP, and I tried chmoding the directory to 777 using chmod() through the script. And when that didn't work, I tried using the method with ftp_site() used by the latest note (by zual__ at gogo dot mn on the chmod() article). That didn't work either, and I heard at another message that I needed to set group to Apache (which is why I posted my other thread). That didn't work either, so I now I'm wondering if I'm doing something wrong. Here's my code:
using chmod()
using ftp_site()PHP Code:chmod($upload_dir, 0777);
using chgrp()PHP Code:$connection = ftp_connect($ftp_server);
$uploaded_filename = basename($_FILES['userfile']['name']);
$uploaded_file = $upload_dir . '/' . $uploaded_filename;
if(!$connection)
die('Unable to connect...');
if(!ftp_login($connection, $ftp_user, $ftp_pass))
die('Unable to login...');
if(!ftp_site($connection, 'CHMOD 0777, ' . $upload_dir))
die('Unable to CHMOD');
I remember reading somewhere that the FTP root is different from the regular root path (like if your root path is /home/username/public_html, your FTP root path would be /public_html or something like that, I'm not sure what it would be like for shared hosting accounts here, which is what I have).PHP Code:chgrp($upload_dir, 'httpd');
So, is there something I'm doing wrong or am I missing something? Is this some sort of server-related thing? Thanks!



LinkBack URL
About LinkBacks




Reply With Quote




Bookmarks