lilman Posted November 19, 2006 Share Posted November 19, 2006 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 More sharing options...
fert Posted November 19, 2006 Share Posted November 19, 2006 Have you tried using $_FILES instead of $HTTP_POST_FILES and you do not need the quotes here:[code]switch("$userfile_error")[/code] Link to comment https://forums.phpfreaks.com/topic/27745-file-upload-start-printing-the-code/#findComment-126950 Share on other sites More sharing options...
lilman Posted November 19, 2006 Author Share Posted November 19, 2006 I changed $HTTP_POST_FILES to $_FILES and removed the "" but it is still printing my PHP code instead of running it. Link to comment https://forums.phpfreaks.com/topic/27745-file-upload-start-printing-the-code/#findComment-126951 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.