Bruce Gust
asked on
How can I use PHP to move files from one directory to another.
I've got a database with a life of mp3 file names. I want to go through that database, pick the mp3 file from the directory it resides in and move it to another directory.
I've seen PHP move_uploaded_file, but I can't tell where the starting directory is and where the directory is that you're moving things to.
Check it out:
Here's my select statement:
$jorja="select * from mp3_fix order by id";
$jorja_query="mysqli_query ($cxn, $jorja);
while($jorja_row=mysqli_fe tch_assoc( $jorja_que ry))
{
...right here. What do I do?
I've seen this:
$uploads_dir = '/mp3_folder';
foreach ($_FILES["pictures"]["erro r"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_n ame"][$key ];
$name = $_FILES["pictures"]["name" ][$key];
move_uploaded_file($tmp_na me, "$uploads_dir/$name");
}
}
...but I couldn't tell where I would put my original directory (mp3) and the directory where I'm moving things to (mp3_fix).
How do I pull this off?
I've seen PHP move_uploaded_file, but I can't tell where the starting directory is and where the directory is that you're moving things to.
Check it out:
Here's my select statement:
$jorja="select * from mp3_fix order by id";
$jorja_query="mysqli_query
while($jorja_row=mysqli_fe
{
...right here. What do I do?
I've seen this:
$uploads_dir = '/mp3_folder';
foreach ($_FILES["pictures"]["erro
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_n
$name = $_FILES["pictures"]["name"
move_uploaded_file($tmp_na
}
}
...but I couldn't tell where I would put my original directory (mp3) and the directory where I'm moving things to (mp3_fix).
How do I pull this off?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER