Nifty. To share my finding ...
Thanks,
John

<html>
  <head>
    <title>Upload File</title>
</head>
<body>
C:\WINDOWS\Bureau\microweb\ERIC.TXT<br>
<?php
if(!$userfile){
?>
 <form enctype="multipart/form-data" action="uploadintostring.php" method="post">
 <div>Read this file: <input name="userfile" type="file"></div>
 <div><input type="submit" value="Read File"></div>
 </form>
<?php
}else{
# $fh=fopen($_FILES['userfile']['tmp_name'], 'r');
 $fh=fopen($HTTP_POST_FILES['userfile']['tmp_name'], 'r');
 if(!$fh)
 {
 phpinfo();
 die('could not open file for reading');
 }
# $fileContents=fread($fh, filesize($_FILES['userfile']['tmp_name']));
 $fileContents=fread($fh, filesize($HTTP_POST_FILES['userfile']['tmp_name']));
 fclose($fh);
?>
 <h1>Upload Results</h1>
 <p>Your file contained:
  <?php
  echo "<form>\n";
  echo "<textarea cols=50 rows=6 nowrap>$fileContents</textarea>\n";
  echo "</form>\n";
  #echo ($fileContents);
  ?>
 </p>

<?php
}
?>

<pre>file_uploads = 1
upload_max_filesize = 2M
upload_tmp_dir = no vlaue
HTTP_POST_FILES["userfile"]
Array
(
[name] => ERIC.TXT
[type] => text/plain
[tmp_name] => C:\WINDOWS\TEMP\phpD3.TMP
[size] => 2492
)</pre>

</body>
</html>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to