Guest User

Untitled

a guest
Mar 8th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2. echo '<form name="submitExemption" enctype="multipart/form-data" method="POST" action="submitRequest.php">';
  3. echo '<fieldset>';
  4. echo '<font class="label">Name: </font>'.$_SESSION["first"].' '.$_SESSION["last"].'<br><br>';
  5. ?>
  6. Choose a file to upload: <input type="file" name="f1"><br>
  7. Choose a file to upload: <input type="file" name="f2"><br>
  8. Choose a file to upload: <input type="file" name="f3"><br><br>
  9. <?php
  10. echo '<input type="button" value="Submit Request" onclick="checkFields()">';
  11. echo '</fieldset>';
  12. echo '</form>';
  13. ?>
  14.  
  15. // submitRequest.php is below
  16.  
  17. foreach($_FILES as $key => $value) {
  18. if($_FILES[$key]['name'] != "") {
  19. if($_FILES[$key]['error'] == 0) {
  20. ${"name".$key} = mysql_real_escape_string($_FILES[$key]['name']);
  21. ${"mime".$key} = mysql_real_escape_string($_FILES[$key]['type']);
  22. ${"size".$key} = intval($_FILES[$key]['size']);
  23. ${"data".$key} = mysql_real_escape_string(file_get_contents($_FILES[$key]['tmp_name']));
  24. }else {
  25. die('An error accured while the file was being uploaded.');
  26. }
  27. }
  28. }
Add Comment
Please, Sign In to add comment