Hi everyone, looking for some advice please.
I had a mkdir working great on a shared hosting account I had,
I have since moved from a shared hosting account to a virtual dedicated server, now the mkdir is not working as previous.
Before i moved server is was using a simple
//make directory using the users id and the last id
mkdir("products/$id/$lastid",0777);
I have tried many different ways trying to get the above to work like it did on the shared hosting.
All the information is being sent to mysql correctly, but no directory is being created in the users folder.
Can someone point me in the right direction please.
here is the code im using on the VDS -
$dest = "/var/www/vhosts/domain/httpdocs/products/$id/";
$user_name = "ftp_username";
mkdir("$lastid",0777);
chown($dest, $user_name);
////////////////////////////////////////////////////////////////////////////////////////////////////////////
$img1 = $_FILES['jan_image']['name'];
//add a security check, to make sure only allowed files are uploaded
$ext=explode('.',$img1);//explode the image name into an array to get the extension
$allowed_exts=array('jpg','jpeg','png','bmp','gif');// allowed extensions, add or remove any extension you want allowed(LOWER CASE ONLY)
if(in_array(strtolower($ext[1]), $allowed_exts)){//file type is allowed!
//trades/$id/$lastid
$dest="$lastid/".$img1;
$val= move_uploaded_file($_FILES['jan_image']['tmp_name'], $dest);
chmod($dest, 0644);//make sure you have permissions for the file
if($val)
{ //update database and rename
rename($dest, ''.$lastid.'/logo.jpg');
$dest="".$lastid."/logo.jpg";//set $dest to the new file name so the database entry is correct
mysql_query("update table set img1='$dest' where uid=$lastid");
}
}
what I am not sure how to do, if required is to create a script to add the ftp-username and password, if I cant get the above to like on the shared hosting server.