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