Can I programmatically change the path to a file using PHP?
For example, change D:\ISO & SOFT\test.txt
to D:\test.txt
.
Can I programmatically change the path to a file using PHP?
For example, change D:\ISO & SOFT\test.txt
to D:\test.txt
.
For this purpose you can simple move the file from the present path to the desired path.
Use the following steps for moving a file in PHP:
$uploads_dir = '/uploads'; // Desired path
foreach ($_FILES["pictures"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["pictures"]["tmp_name"][$key];
$name = $_FILES["pictures"]["name"][$key];
move_uploaded_file($tmp_name, "$uploads_dir/$name"); //Moving file at desire path
}
}