Hi there Heroes...
I am working on a website and it has an "UPLOAD FILE" admin page for the website "administrator".
The upload page (browse file) works well in my localhost but when it is used on the server itself, the error message "Could not copy file, your file must be corrupted" appears for any type of file uploaded... whether it is a small file or large, or whether it is a graphics, pdf or txt, even if the file indeed is not corrupted.
Here is the portion of my script:
<?
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>");
}
}
}
?>