taurus5_6
January 6th, 2007, 10:24 AM
I have an upload image page in my site and it works pretty well in my localhost.
However, when i uploaded it in my server, the error message I have in my php is displayed. What seems to be the problem?
<?php $saveto = $_POST["saveto"];//get action variable from browsefile ?>
<?
if(file_exists("../images/$saveto/" + $_FILES['txt_file']['name'])) {
echo("<center>
<font class=\"blackHeader\"><b>File already exists! Please rename the file.</b></font> <br /><br />
<a href=\"javascript: window.close()\" class=\"black\"><u>close this window</u></a>
</center>
");
}
else {
if(is_file($txt_file)) {
$target_path = "../images/$saveto/";
//Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['txt_file']['name']);
$_FILES['txt_file']['tmp_name'];
if(move_uploaded_file($_FILES['txt_file']['tmp_name'], $target_path)) {
echo("<script language=\"javascript\" type=\"text/JavaScript\">
<!--
window.opener.document.frm.$frm.value=\"$txt_file_name\";
window.opener.focus();
window.close();
//-->
</script>");
}
else {
echo("<div align=\"center\"><font class=\"blackHeader\">Could not copy file. Your file must be corrupted!</font></div>");
}
}
}
?>
What seems to be the problem? Im so confused... thanks.
However, when i uploaded it in my server, the error message I have in my php is displayed. What seems to be the problem?
<?php $saveto = $_POST["saveto"];//get action variable from browsefile ?>
<?
if(file_exists("../images/$saveto/" + $_FILES['txt_file']['name'])) {
echo("<center>
<font class=\"blackHeader\"><b>File already exists! Please rename the file.</b></font> <br /><br />
<a href=\"javascript: window.close()\" class=\"black\"><u>close this window</u></a>
</center>
");
}
else {
if(is_file($txt_file)) {
$target_path = "../images/$saveto/";
//Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['txt_file']['name']);
$_FILES['txt_file']['tmp_name'];
if(move_uploaded_file($_FILES['txt_file']['tmp_name'], $target_path)) {
echo("<script language=\"javascript\" type=\"text/JavaScript\">
<!--
window.opener.document.frm.$frm.value=\"$txt_file_name\";
window.opener.focus();
window.close();
//-->
</script>");
}
else {
echo("<div align=\"center\"><font class=\"blackHeader\">Could not copy file. Your file must be corrupted!</font></div>");
}
}
}
?>
What seems to be the problem? Im so confused... thanks.