Shaun1978
01-25-2009, 06:52 AM
I'm coding an image website that allows users to upload images, no problem with uploading images. What I am having trouble with is, when a user signs up, I create a specfic folder for that member, this is where there images will go.
The code below is the function, I've obviouslly taken out the ftp login stuff. The function main duty is to change the folder permissions of the members specfic folder, however I am having trouble grabbing the excat members folder.
<?php
function modechanger ($mod,$folder) {
$host = '';
$user = '';
$password = '';
$conn = ftp_connect("$host");
if (!$conn)
{
echo 'Error: Could not connect to ftp server';
exit;
}
@ $result = ftp_login($conn, $user, $password);
if (!$result)
{
echo "Error: Could not log on as $user";
ftp_quit($conn);
exit;
}
if (ftp_site($conn, 'CHMOD '.$mod.' '.$folder)) {
return "true";
}
else {
return "false";
ftp_quit($conn);
exit;
}
ftp_close($conn);
}
Below is code that communicates with above function.
$folder = '../content/$uname/';
modechanger("0777" , "$folder");
I keep getting this msg
"Warning: ftp_site() [function.ftp-site]: ../content/$uname/: No such file or directory in /hsphere/local/home/scotsman/ladyfame.com/stuff/images.php on line 31"
The path to folder is correct and I need to move out of folder and back, then into the content folder. But for some reason the $folder variable isn't passing across with the information. The $uname is set with the members name, this is done through a hidden field in the upload image form.
any help would be greatly appreciated.
:)
The code below is the function, I've obviouslly taken out the ftp login stuff. The function main duty is to change the folder permissions of the members specfic folder, however I am having trouble grabbing the excat members folder.
<?php
function modechanger ($mod,$folder) {
$host = '';
$user = '';
$password = '';
$conn = ftp_connect("$host");
if (!$conn)
{
echo 'Error: Could not connect to ftp server';
exit;
}
@ $result = ftp_login($conn, $user, $password);
if (!$result)
{
echo "Error: Could not log on as $user";
ftp_quit($conn);
exit;
}
if (ftp_site($conn, 'CHMOD '.$mod.' '.$folder)) {
return "true";
}
else {
return "false";
ftp_quit($conn);
exit;
}
ftp_close($conn);
}
Below is code that communicates with above function.
$folder = '../content/$uname/';
modechanger("0777" , "$folder");
I keep getting this msg
"Warning: ftp_site() [function.ftp-site]: ../content/$uname/: No such file or directory in /hsphere/local/home/scotsman/ladyfame.com/stuff/images.php on line 31"
The path to folder is correct and I need to move out of folder and back, then into the content folder. But for some reason the $folder variable isn't passing across with the information. The $uname is set with the members name, this is done through a hidden field in the upload image form.
any help would be greatly appreciated.
:)