1$upload_folder = "upload/";
2$file_location = $upload_folder . basename($_FILES["fileToUpload"]["name"]);
3
4 if(isset($_FILES['fileToUpload'])){
5
6 if(move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $file_location)){
7
8 echo 'Files has uploaded';
9 };
10
11 }
1<?php
2 if (move_uploaded_file($_FILES['userfile']['tmp_name'], "/documents/new/")) {
3 print "Uploaded successfully!";
4 } else {
5 print "Upload failed!";
6 }
7?>
1
2<?php
3$uploads_dir = '/uploads';
4foreach ($_FILES["pictures"]["error"] as $key => $error) {
5 if ($error == UPLOAD_ERR_OK) {
6 $tmp_name = $_FILES["pictures"]["tmp_name"][$key];
7 // basename() may prevent filesystem traversal attacks;
8 // further validation/sanitation of the filename may be appropriate
9 $name = basename($_FILES["pictures"]["name"][$key]);
10 move_uploaded_file($tmp_name, "$uploads_dir/$name");
11 }
12}
13?>
14
15