Guest User

Untitled

a guest
Jan 22nd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <html>
  2. <body>
  3. <form action="processStuff.php" enctype="multipart/form-data" method="POST">
  4. username: <input type="text" name="username" />
  5. password: <input type="password" name="password" />
  6.  
  7. <p>
  8. <input type="file" name="uploadFile[]" /><br />
  9. <input type="file" name="uploadFile[]" /><br />
  10. <input type="file" name="uploadFile[]" /><br />
  11. <!-- Add as many of these as you want -->
  12. </p>
  13.  
  14. <p>
  15. <input type="submit" />
  16. </p>
  17. </form>
  18. </body>
  19. </html>
  20.  
  21. <pre>
  22. <?php
  23.  
  24. echo '<h2>Username & password</h2>'
  25. echo "Username: {$_POST['username']}nPassword: {$_POST['password']}";
  26. echo '<hr />';
  27.  
  28. echo '<h2>Uploaded files</h2>'
  29. foreach($_FILES['uploadFile']['tmp_name'] as $i => $tempUploadPath) {
  30. if (empty($tempUploadPath)) {
  31. // this <input type="file" /> was "blank"... no file selected
  32. } else {
  33. // a file was uploaded
  34. echo '<strong>A file named "', $_FILES['uploadFile']['name'][$i], "" was uploaded</strong>n";
  35. echo "ttemporarily stored at: ", $tempUploadPath, "n";
  36. echo "tmime type: ", $_FILES['uploadFile']['type'][$i], "n";
  37. echo "tsize: ", $_FILES['uploadFile']['size'][$i], " bytesn";
  38. echo "terror code",
  39. ((empty($_FILES['uploadFile']['size'][$i])
  40. ? '<em>no errror</em>'
  41. : $_FILES['uploadFile']['size'][$i])),
  42. "nn";
  43.  
  44. // do something useful with the uploaded file
  45. // access it via $tempUploadPath and use move_uploaded_file() to move
  46. // it out of the temp path before you manipulate it in any way!!!!!
  47. // see http://us3.php.net/features.file-upload
  48. // and http://us3.php.net/manual/en/function.move-uploaded-file.php
  49. }
  50. }
  51.  
  52. ?>
  53. </pre>
Add Comment
Please, Sign In to add comment