Reply to File extension .txt being added

File extension .txt being added new!
by Tony, 15 years, 10 months ago
I'm trying to allow HTML files to be uploaded, and I've added a check to ensure that only HTML files are uploaded.

But every time I upload one, it is getting the .txt extension added. I've tried setting no_script to false, but when I do this I then get an 'Incorrect file type' error for any file that I try to upload.

Here's the code;
$newmenu = new upload($_FILES['menu_file']);
if ($newmenu->uploaded) {
  if ($newmenu->file_src_mime != 'text/html') {
    die('Error: Error Message' . $newmenu->clean());
  } else {
    $newmenu->file_auto_rename = false;
    $newmenu->file_safe_name = true;
    $newmenu->file_overwrite = true;
    $newmenu->no_script = false;
    $newmenu->process('../menus/');
    if ($newmenu->processed) {
      echo 'File Uploaded';
    } else {
      echo 'error : ' . $newmenu->error;
    }
  }
}
Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important