Advertisement
hidesubs

test

May 7th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['submit'])) {
  3. $nama = trim(strtolower($_POST['nama']));
  4. $npm = trim(strtolower($_POST['npm']));
  5.  
  6. $uploaddir = 'submitted/';
  7. $target_file = $uploaddir . $nama . '_' . $npm . '_' . $_FILES["file"]["name"];
  8. if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
  9. ?>
  10. <script>window.alert('OK!');</script>
  11. <?php
  12. }
  13. else {
  14. ?>
  15. <script>window.alert('Error!');</script>
  16. <?php
  17. }
  18. }
  19. ?>
  20. <form name='upload_frm' enctype='multipart/form-data' method='post'>
  21. <table>
  22. <tr>
  23. <td>Nama</td>
  24. <td>&nbsp;</td>
  25. <td><input type='text' name='nama'></td>
  26. </tr>
  27. <tr>
  28. <td>NPM</td>
  29. <td>&nbsp;</td>
  30. <td><input type='text' name='npm'></td>
  31. </tr>
  32. <tr>
  33. <td>File</td>
  34. <td>&nbsp;</td>
  35. <td><input type='file' name='file'></td>
  36. </tr>
  37. </table>
  38. <input type='submit' name='submit' value='Upload'>
  39. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement