My code is being executed here "/public_html/rename.php" with this
my error message isPHP Code:rename("products/$dir/$value", "products/$dir/$submitted");
rename("products/$dir/tmb/$value", "products/$dir/tmb/$submitted");
this partrename(products/Helmets/H200_LP1.jpg,products/Helmets/H200_LP1.jpg) [function.rename]: No such file or directory in /home/theleat1/public_html/rename.php on line 11Makes me think the server may be parsing the rename incorrectly because there is a space there.(products/Helmets/H200_LP1.jpg,products/Helmets/H200_LP1.jpg)
The figures are located in /public_html/products/Helmets and /public_html/products/Helmets/tmb.
my full code is:
On another side question does $_POST change . to underscores when it is inputted as the key for example figure1.jpg become figure1_jpg. Thanks.PHP Code:<?php
session_start();
$_SESSION['logged_in'] = "yes";
$dir = $_GET['dir'];
foreach($_POST as $submitted) {
$value = key($_POST);
$unset_value = key($_POST);
$value = preg_replace('/(.*?)_jpg/', "$1.jpg", $value);
echo "original= products/$dir/$value" . " newname= products/$dir/$submitted<br />";
echo "original= products/$dir/tmb/$value" . " newname= products/$dir/tmb/$submitted<br />";
rename("products/$dir/$value", "products/$dir/$submitted");
rename("products/$dir/tmb/$value", "products/$dir/tmb/$submitted");
unset($_POST[$unset_value]);
}
?>



Reply With Quote

Bookmarks