Page 1 of 1

Page Can Not Be Displayed?!

Posted: Tue Dec 23, 2003 9:25 am
by chunkT
I am a new coder to php I have a strange problem which might me something just stupid I am over looking. I am buidling an upload page from where I refernce a .php page that when its called I get a page can not be displayed?! When I refresh the page it loads but tells me my nothing has been selected to upload. If it ran the first time I think the variables would be there cause I echo them and they are registered.

here is my code.

upload.htm

Code: Select all

<form enctype="multipart/form-data" action="vf.php" method="POST">
<table>
<tr>
   <td><input type="hidden" name="MAX_FILE_SIZE" value="30000">
           Upload this file: <input name="userfile" type="file">
          <input type="submit" value="Upload File"></td>
</tr>
</table>
</form>
and here is my vf.php code

Code: Select all

<?php

// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES

if($_FILES&#1111;'userfile']&#1111;'name'] == '') &#123;
       echo 'You did not select a photo to upload';
       &#125;
elseif($_FILES&#1111;'userfile']&#1111;'size'] == 0) &#123;
   echo 'There appears to be a problem with the photo your are uploading';
       &#125;
elseif($_FILES&#1111;'userfile']&#1111;'size'] > $MAX_FILE_SIZE) &#123;
        echo 'The photo you selected is too large';
       &#125;
elseif(!getimagesize($_FILES&#1111;'userfile']&#1111;'tmp_name'])) &#123;
        echo 'The photo you selected is not a valid image file';
       &#125;
else &#123;
   $uploaddir = '/var/www/html/upload/'; // remember the trailing slash!
   $uploadfile = $uploaddir. $_FILES&#1111;'userfile']&#1111;'name'];
   if(move_uploaded_file($_FILES&#1111;'userfile']&#1111;'tmp_name'], $uploadfile)) &#123;
       echo 'Upload file success!';
   &#125;
   else &#123;
       echo 'There was a problem uploading your file.<br>';
       print_r($_FILES);
   &#125;
&#125;

?>
Any help would be appreciated. Also other php programs that call php pages are fine.