File uploading action page


And here is the Example of the action page


if($_FILES['fileimage']['name'])
{

$max_size = 10000*10000; // the max. size for uploading
$my_upload = new file_upload;
$my_upload->upload_dir = "docs/"; // "files" is the folder for the uploaded files (you have to create this folder)
$my_upload->extensions = array(".png", ".zip", ".pdf",".jpeg",".gif",".jpg",".doc",".jpeg",".docx",".html",".htm",".php",".jsp",".cfm"); // specify the allowed extensions here
// $my_upload->extensions = "de"; // use this to switch the messages into an other language (translate first!!!)
$my_upload->max_length_filename = 1000; // change this value to fit your field length in your database (standard 100)
$my_upload->rename_file = false;
$my_upload->the_temp_file = $_FILES['fileimage']['tmp_name'];
$my_upload->the_file = $_FILES['fileimage']['name'];
$my_upload->http_error = $_FILES['fileimage']['error'];
//$my_upload->replace = (isset($_POST['replace'])) ? $_POST['replace'] : "n"; // because only a checked checkboxes is true
//$my_upload->do_filename_check = (isset($_POST['check'])) ? $_POST['check'] : "n"; // use this boolean to check for a valid filename
//$new_name = (isset($_POST['name'])) ? $_POST['name'] : "";
if ($my_upload->upload()) { // new name is an additional filename information, use this to rename the uploaded file
$full_path = $my_upload->upload_dir.$my_upload->file_copy;
$_SESSION["FileName"]= $my_upload->get_uploaded_file_info($full_path);
// ... or do something like insert the filename to the database
}

}
else
{
$_SESSION["FileName"] = "";
}