I created two files: "index.html" and "upload.php".
The "index.html" contains a form for sending files as shown below:
-------------------------------------------------------------------------------------
<form enctype="multipart/form-data" action="upload.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000000" />
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
-------------------------------------------------------------------------------------
The contents of the file "upload.php" is shown below:
-------------------------------------------------------------------------------------
<?php
$uploaddir = 'C:\Users\UserName\Documents\uploads\';
$uploadfile = $uploaddir.$_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) {
print "The file is valid and do run with success!";
print_r($_FILES);
} else {
print "Error!";
print_r($_FILES);
}
print "</pre>";
?>
-------------------------------------------------------------------------------------
I changed the following fields in the php configuration file called "php.ini":
-------------------------------------------------------------------------------------
max_execution_time=60000000000
max_input_time=60000000000
memory_limit=1024M
post_max_size=1024M
upload_max_filesize=1024M
-------------------------------------------------------------------------------------
I did it so I could upload files up to 1GB.
However, when performing the procedure for sending files by the browser, the file "upload.php" returns the following error messages:
-------------------------------------------------------------------------------------
Parse error: syntax error, unexpected 'userfile' (T_STRING) in C:\Users\UserName\Documents\scripts\upload.php on line 7
-------------------------------------------------------------------------------------
What do to do upload files?