A relatively simple php file Upload example, can be used when the request is not high, recorded here, convenient later to use when directly over the copy.
$resume = $_files[' Resumefile '];
if ($resume [' name ']!= ')
{
$enableType = array (' jpg ', ' png ', ' gif ', ' Doc ', ' docx ', ' RTF ', ' pdf '); Support format
$maxSize = 1024*1024; Maximum allowable upload of 1M files
$filePath = ' upload/resume/';
$suffix = End (Explode ('. ', $resume [' name ']); Get file suffix name
$resumeName = ' resume_ '. Time (). $suffix;
Size limit
if ($resume [' Size ']> $maxSize)
{
Die (' <script> alert (' Please upload the file below 1M! '); History.back (); </script> ");
}
Formatting restrictions
if (!in_array ($suffix, $enableType))
{
Die (' <script> alert (' Incorrect format, please upload '. Implode (', ', $enableType). "Document in Format! '); History.back (); </script> ");
}
Upload
if (Move_uploaded_file ($resume [' Tmp_name '], $filePath. $resumeName))
{
$attachment = $filePath. $resumeName; File names, writing to the database
}
}