Ten skrypt odbiera dane z formularza i umieszcza w bazie:
<?php require_once('redirect.php'); // Check if a file has been uploaded { // Make sure the file was sent without errors if($_FILES['uploaded_file']['error'] == 0) { // Connect to the database require_once('connect.php'); // Gather all required data $size = $_FILES['uploaded_file']['size']; // Create the SQL query $query = " INSERT INTO file ( file_name, file_type, file_content, file_size, file_created ) VALUES ( '{$name}', '{$mime}', '{$data}', '{$size}', NOW() )"; // Execute the query // Check if it was successfull if($result) { redirect('panel.php?site=files&m='.$mes.'&mtype=confirm'); } else { redirect('panel.php?site=files&m='.$mes.'&mtype=failed'); } } else { redirect('panel.php?site=files&m='.$mes.'&mtype=failed'); } // Close the mysql connection } else { redirect('panel.php?site=files&m='.$mes.'&mtype=failed'); } redirect('panel.php?site=files&m='.$mes.'&mtype=confirm'); ?>
A oto skrypt redirect.php do przekierowania:
<?php function redirect($url) { } else { } } ?>
dane zostaja dodane do bazy i pojawia sie komunikat Sorry could not redirect
Dziekuje za ewentualna pomoc i pozdrawiam
Daniel