Hi, I am developing a Lease Management System, and I need to upload multiple files in a folder. and I want to name the folder where I want to upload in DB.
Here is a code for upload a single file.
first file is sendfile.php
<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="upload.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30001" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
and upload.php file is
<?php
$uploaddir = $_SERVER['DOCUMENT_ROOT'] . "/other/";
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "Successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
print "</pre>";
?>