Advertisement
stronk_8s

FILE UPLOAD

Oct 13th, 2023 (edited)
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | Source Code | 0 0
  1. Profile:
  2. <input type="file" name="uploads[]" multiple>
  3. <input type="submit" name="fupload" value="Upload"><br><br>
  4.  
  5. if(isset($_POST['fupload']))
  6. {
  7. $target_dir="uploads/";
  8. if(!empty(array_filter($_FILES['uploads']['name'])))
  9. {
  10.     foreach($_FILES['uploads']['tmp_name'] as $key=>$value)
  11.     {
  12.         $tmp_file=$_FILES['uploads']['tmp_name'][$key];
  13.         $target_file=$_FILES['uploads']['name'][$key];
  14.         $path=$target_dir.$target_file;
  15.        
  16.         if(move_uploaded_file($tmp_file,$path))
  17.             echo "$target_file successfully uploaded <br>";
  18.         else
  19.             echo "Error uploading $target_file <br>";
  20.     }
  21. }
  22. else
  23.     echo "No such file is selected";
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement