problems with submitting form
Posted: Sat Jan 03, 2004 9:07 am
i dunno why this script does not work for my database......can anyone give me any help??
once i click submit i only get back this page... with the error "You could not be upload due to a system error. We apologize for any inconvenience"
These is the specs
once i click submit i only get back this page... with the error "You could not be upload due to a system error. We apologize for any inconvenience"
Code: Select all
<?php # Script 11.7 - add_file.php
// This page allows users to upload files to the server.
// Set the page title and include the HTML header.
$page_title = 'Upload a File';
if (isset($_POSTї'submit'])) { // Handle the form.
require_once ('../mysql_connect.php'); // Connect to the database.
// Check for a description (not required).
if (!empty($_POSTї'description'])) {
$d = escape_data($_POSTї'description']);
} else {
$d = '';
}
echo "hello";
// Add the record to the database.
$query = "INSERT INTO song (filename, describe) VALUES ('{$_FILESї'upload']ї'name']}', '$d')";
$result = @mysql_query ($query); // Run the query.
if ($result) { // If it ran OK.
echo '<h3>Thank you for upload!</h3>';
exit();
} else { // If it did not run OK.
// Send a message to the error log, if desired.
echo '<p><font color="red" size="+1">You could not be upload due to a system error. We apologize for any inconvenience.</font></p>';
}
mysql_close(); // Close the database connection.
} // End of the main Submit conditional.
?>
<form enctype="multipart/form-data" action="<?php echo $_SERVERї'PHP_SELF']; ?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="524288">
<fieldset><legend>Fill out the form to upload a file:</legend>
<p><b>File:</b> <input type="file" name="upload" /></p>
<p><b>Description:</b> <textarea name="description" cols="40" rows="5"></textarea></p>
</fieldset>
<div align="center"><input type="submit" name="submit" value="Submit" /></div>
</form><!-- End of Form -->These is the specs
Code: Select all
<?php
echo '<pre>';
echo 'PHP Version: '.phpversion()."\n";
echo 'Display Errors: '.(ini_get('display_errors') == '1' ? 'On' : 'Off')."\n";
echo 'Error Level: '.(ini_get('error_reporting') == '2047' ? 'E_ALL' : 'Not E_ALL')."\n";
echo 'Register Globals: '.(ini_get('register_globals') == '' ? 'Off' : 'On')."\n";
echo '</pre>';
/*
PHP Version: 4.3.2
Display Errors: On
Error Level: Not E_ALL
Register Globals: On
*/
?>