Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2.  
  3. class UploadController extends \Controller\Base {
  4. public static function single() {
  5. foreach ($_FILES as $file)
  6. {
  7. $filename = $file['name'][0];
  8. $destination = './' . $filename;
  9. print_r($file);
  10. foreach($file['tmp_name'] as $location) {
  11. if (move_uploaded_file($location, $destination))
  12. {
  13. // also insert the file into the database here
  14.  
  15. }
  16. }
  17.  
  18. }
  19. }
  20.  
  21. public static function multi() {
  22. foreach ($_FILES as $file)
  23. {
  24. $filename = $file['name'];
  25. $destination = './' . $filename;
  26. //print_r($file);
  27. if (move_uploaded_file($file['tmp_name'], $destination))
  28. {
  29. // also insert the file into the database here
  30.  
  31. }
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement