Uploading Files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm at one of those frustration levels.... can't seem to get a script working that will post and upload a file to the server. I"m working with the below. Can you help?

<?php
  $numoffile = 1;

  $file_dir  = "d:/upload/";
  if ($_FILES['myfiles']) {
  print_r ($_FILES);
    for ($i=0;$i<$numoffile;$i++) {
      if (trim($_FILES['myfiles']['name'][$i])!="") {
        $newfile = $file_dir.$_FILES['myfiles']['name'][$i];
        move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], $newfile);
        $j++;
      }
    }
  }
  if (isset($j)&&$j>0) print "Your file(s) has been uploaded.<br>";

 echo '
<form enctype="multipart/form-data" action="__URL__" method="POST">
    <!-- MAX_FILE_SIZE must precede the file input field -->
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    <!-- Name of input element determines name in $_FILES array -->
    Send this file: <input name="myfiles" type="file" />
    <input type="submit" value="Send File" />
</form>';

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux