Jarrin
Gebruiker
- Lid geworden
- 21 mrt 2006
- Berichten
- 544
ik heb totaal geen verstand van php en heb een php upload-script gevonden. maar ik weet niet hoe ik dit op een web pagina moet zetten:
ik heb geen idee wat ik hiermee moet doen.(hoe ik het dus in een webpagina zet), hoe ik hem naar een email-adres moet laten sturen of de grote moet aanpassen van het upload-bestand,
zou iemand mij hier verder op weg willen helpen?
PHP:
<?php
include ($_SERVER['DOCUMENT_ROOT']."/classes/upload/upload_class.php"); //classes is the map where the class file is stored (one above the root)
$max_size = 1024*100; // the max. size for uploading
$my_upload = new file_upload;
$my_upload->upload_dir = $_SERVER['DOCUMENT_ROOT']."/files/"; // "files" is the folder for the uploaded files (you have to create this folder)
$my_upload->extensions = array(".trk"); // 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 = 50; // change this value to fit your field length in your database (standard 100)
$my_upload->rename_file = true;
if(isset($Submit)) {
$my_upload->the_temp_file = $_FILES['upload']['tmp_name'];
$my_upload->the_file = $_FILES['upload']['name'];
$my_upload->http_error = $_FILES['upload']['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
if ($my_upload->upload($new_name)) { // new name is an additional filename information, use this to rename the uploaded file
$full_path = $my_upload->upload_dir.$my_upload->file_copy;
$info = $my_upload->get_uploaded_file_info($full_path); // just some information about the uploaded file
// ... or do something like insert the filename to the database
}
}
?>
zou iemand mij hier verder op weg willen helpen?