Hello.
May I please briefly ask:-
1. Once i've added a record into a database, and got the last record ID, I would like to copy a jpeg image from one folder to another, then rename it. May I ask if the snippet of code looks ok, as it doesn't copy, and doesn't rename.
2. Also, I'm unable to rename and move an uploaded video file. It will upload, but will not rename and move.
The line of code that doesn't work is:-
$filename is the filename, chosen by the user, and it is renamed to $newfly. eg $newfly is made up vy $last_id.file-extenstion (1.mp4, 2.mp4 etc)
Thank You.
May I please briefly ask:-
1. Once i've added a record into a database, and got the last record ID, I would like to copy a jpeg image from one folder to another, then rename it. May I ask if the snippet of code looks ok, as it doesn't copy, and doesn't rename.
Code:
$last_id = $conn->lastInsertId();
//Create temporary profile image
$entryfle = $last_id.".jpg";
// Store the path of source file
$source = '/central/system/graphics/noimage.jpg';
// Store the path of destination file
$destination = '/myaccount/profile/image/noimage.jpg';
copy($source, $destination);
rename("/myaccount/profile/image/noimage.jpg", "/myaccount/profile/image/". $entryfle);
2. Also, I'm unable to rename and move an uploaded video file. It will upload, but will not rename and move.
The line of code that doesn't work is:-
Code:
rename ("/video/add/upload/$filename", "/video/add/upload/$newfly");
$filename is the filename, chosen by the user, and it is renamed to $newfly. eg $newfly is made up vy $last_id.file-extenstion (1.mp4, 2.mp4 etc)
Thank You.