bluewalrus
12-20-2010, 12:48 AM
My code is being executed here "/public_html/rename.php" with this
rename("products/$dir/$value", "products/$dir/$submitted");
rename("products/$dir/tmb/$value", "products/$dir/tmb/$submitted");
my error message is
rename(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 11
this part
(products/Helmets/H200_LP1.jpg,products/Helmets/H200_LP1.jpg)
Makes me think the server may be parsing the rename incorrectly because there is a space there.
The figures are located in /public_html/products/Helmets and /public_html/products/Helmets/tmb.
my full code is:
<?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]);
}
?>
On another side question does $_POST change . to underscores when it is inputted as the key for example figure1.jpg become figure1_jpg. Thanks.
rename("products/$dir/$value", "products/$dir/$submitted");
rename("products/$dir/tmb/$value", "products/$dir/tmb/$submitted");
my error message is
rename(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 11
this part
(products/Helmets/H200_LP1.jpg,products/Helmets/H200_LP1.jpg)
Makes me think the server may be parsing the rename incorrectly because there is a space there.
The figures are located in /public_html/products/Helmets and /public_html/products/Helmets/tmb.
my full code is:
<?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]);
}
?>
On another side question does $_POST change . to underscores when it is inputted as the key for example figure1.jpg become figure1_jpg. Thanks.