1

HTML:

<input name="files" type="file" />
<button type="submit" class="btn btn-gradient-primary mr-2">Save</button>

PHP:

$pathtosave = 'uploads/';
echo $_FILES["files"]['name']."<br>";
//echo $_FILES["files"]['tmp_name']."<br>";
echo $_FILES["files"]['size']."<br>";
echo $_FILES['files']['error']."<br>";
move_uploaded_file($_FILES['files']['name'], $pathtosave);

enter image description here

Amanjot Kaur
  • 2,028
  • 4
  • 18
  • 33
thejashwini l
  • 31
  • 1
  • 8
  • Look up error codes in the php manual, `UPLOAD_ERR_NO_TMP_DIR` has a value of 6 so you probably have no set temp directory for files to be uploaded to or permissions aren't set right for php to use the one that is set – Patrick Evans Mar 05 '20 at 11:58
  • 1
    Look here, https://www.php.net/manual/en/features.file-upload.errors.php You will get your error explanation. Look here how to use `move_uploaded_file()` https://stackoverflow.com/questions/18929178/move-uploaded-file-function-is-not-working – Amanjot Kaur Mar 05 '20 at 12:23

0 Answers0