Ok, next question:

Here's my upload script:

      if ($upfile1=="none")
            echo "no file selected for upload please go back and select a

      if ($upfile1_size==0)
            echo "No data was transferred, your file may be too large or
may not exist";
      $upfile1_name=str_replace(' ','_',$upfile1_name);
      if (file_exists("/var/www/html/files/$upfile1_name"))
      echo "<Font color=red>file $upfile1_name already
exists</font><p>Note: Your file may have been renamed if it contained
spaces, this is so that links to the file will work correctly.</P><P> If
you want to replace an existing file, Talk to Michael Knauf.";

      if (!is_uploaded_file($upfile1))
            echo "file may contain upload attack, this is not allowed";


      if ( !copy($upfile1, $okfile1))
            echo "Could not move file";

      echo "File uploaded successfully<BR><BR>";
      $fp = fopen($okfile1, "r");
      $contents = fread ($fp, filesize ($okfile1));

      $fp = fopen($okfile1, "w");
      fwrite($fp, $contents);

      echo "<HR>";

      echo "you can link to your file at: <A

That all works fine, and accepts a file from a simple html form file
element: <input type="file" name="upfile1">

So I think, my, wouldn't it be nice if they could upload 3 or 4 files at

Problem 1, I'm not sure how to structure that, obviously a loop of some
sort, but what makes me cry for help, is that I simply duplicated my html
input <input type="file" name="upfile2"> and called it upfile2, and
duplicated my php code and changed each second instance of upfile1 to
upfile2 which worked fine, too till I trigger any of the error conditions
in the first iteration... then the "exit" function happens and the second
file is ignored (because i've exited out of the script, I know) the
question is how I exit out of the first iteration but not the second...


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

Reply via email to