Jump to content

File Upload - Start Printing the Code


lilman

Recommended Posts

Here is start of my code which I saved as upload.php

[code]
<?php
$userfile = $HTTP_POST_FILES['userfile']['tmp_name'];
$userfile_name = $HTTP_POST_FILES['userfile']['name'];
$userfile_size = $HTTP_POST_FILES['userfile']['size'];
$userfile_type = $HTTP_POST_FILES['userfile']['type'];
$userfile_error = $HTTP_POST_FILES['userfile']['error'];

if($userfile_error>0)
{
    echo 'Problem: ';
    switch ("$userfile_error")
    {
      case 1:  echo 'File exceeded upload_max_filesize';  break;
      case 2:  echo 'File exceeded max_file_size';  break;
      case 3:  echo 'File only partially uploaded';  break;
      case 4:  echo 'No file uploaded';  break;
    }
    exit;
}
[/code]

After the code hits "if($userfile_error>" it starts printing the rest of the code out and displaying it to the broswer, like:

[quote]0) { echo 'Problem: '; switch ("$userfile_error") { case 1: echo 'File exceeded upload_max_filesize'; break; case 2: echo 'File exceeded max_file_size'; break; case 3: echo 'File only partially uploaded'; break; case 4: echo 'No file uploaded'; break; } exit; }[/quote]

Does anyone have any idea why it would stop reading the code and instead start printing the code?
Link to comment
https://forums.phpfreaks.com/topic/27745-file-upload-start-printing-the-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.