I hope it will help.
<form action="accept-file.php" method="post" enctype="multipart/form-data">
Your Photo: <input type="file" name="image" size="25" />
<input type="submit" name="submit" value="Submit" />
</form>
After you create this HTML form, you’ll now have to write a PHP script in order to process the PHP file upload. Below you’ll find PHP file upload script code for the same.
PHP Script:
if($_FILES['image']['name'])
{
if(!$_FILES['image']['error'])
{
$new_file_name = strtolower($_FILES['image']['tmp_name']);
if($_FILES['image']['size'] > (1024000))
{
$valid_file = false;
$message = 'Oops! Your file\'s size is to large.';
}
if($valid_file)
{
move_uploaded_file($_FILES['image']['tmp_name'], 'uploads/'.$new_file_name);
$message = 'Congratulations! Your file was accepted.';
}
}
else
{
$message = 'Ooops! Your upload triggered the following error: '.$_FILES['image']['error'];
}
}
$_FILES['field_name']['name']
$_FILES['field_name']['size']
$_FILES['field_name']['type']
$_FILES['field_name']['tmp_name']