tjome
asked on
how to move a file/photo to an folder using php?
Hi experts,
how to move a file to a new folder using php?
thx.
how to move a file to a new folder using php?
thx.
did you try with this function http://php.net/manual/en/function.move-uploaded-file.php ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
This code will move file to another folder in php:
if(isset($_POST['next_page '])) {
if (!is_dir('../images/upload s/listers/ '.$_SESSIO N['loggedi n_lister_i d'])) {
mkdir('../images/uploads/l isters/'.$ _SESSION[' loggedin_l ister_id'] );
}
foreach($_SESSION['uploade d_photos'] as $key => $value) {
$target_path = '../images/uploads/listers /'.$_SESSI ON['logged in_lister_ id'].'/';
$target_path = $target_path . basename($value);
if(rename($value, $target_path)) {
echo "The file ". basename($value). " has been uploaded<br />";
} else{
echo "There was an error uploading the file, please try again!";
}
} //end foreach
}
This code will move file to another folder in php:
if(isset($_POST['next_page
if (!is_dir('../images/upload
mkdir('../images/uploads/l
}
foreach($_SESSION['uploade
$target_path = '../images/uploads/listers
$target_path = $target_path . basename($value);
if(rename($value, $target_path)) {
echo "The file ". basename($value). " has been uploaded<br />";
} else{
echo "There was an error uploading the file, please try again!";
}
} //end foreach
}
ASKER
thank you for your help