Problem
I got this cool tool from 'Howtos' posted by ATLI, but I'm having trouble on posting or uploading files bigger than 15000KB although I create the table field into a 'LongBlob'. Is there any other way to maximize the the field?
Script[code=php]
<?php
# Check if a file has been uploaded
if(isset($_FILE S['uploaded_file']))
{
# Make sure the file was sent without errors
if($_FILES['uploaded_file']['error'] == 0)
{
# Connect to the database
$dbLink = mysql_connect(" localhost","use r", "password")
or die("Error! Failed to connect to the MySQL server!");
mysql_select_db ("tablename" , $dbLink)
or die("Error! Failed to select a database!");
# Gather all required data
$name = mysql_real_esca pe_string($_FIL ES['uploaded_file']['name'], $dbLink);
$mime = mysql_real_esca pe_string($_FIL ES['uploaded_file']['type'], $dbLink);
$size = $_FILES['uploaded_file']['size'];
$author = $_POST['author'];
$requestor = $_POST['requestor'];
$description = $_POST['description'];
$data = mysql_real_esca pe_string(file_ get_contents($_ FILES ['uploaded_file']['tmp_name']), $dbLink);
# Create the SQL query
$query = "
INSERT INTO fileStorage (
FileName, FileMime, FileSize, FileData, Created, Author,
)
VALUES (
'{$name}', '{$mime}', {$size}, '{$data}', NOW(), '$author'
)";
# Execute the query
$result = mysql_query($qu ery, $dbLink);
# Check if it was successfull
if($result)
{
echo "Success! Your file was successfully added!";
echo "$author";
}
else
{
echo "Error! Failed to insert the file";
echo "<pre>". mysql_error($db Link) ."</pre>";
}
}
else
{
echo "Error!
An error accured while the file was being uploaded.
Error code: ". $_FILES['uploaded_file']['error'];
}
# Close the mysql connection
mysql_close($db Link);
}
else
{
echo "Error! A file was not sent!";
}
# Echo a link back to the mail page
echo '<p>Click <a href="cmr.php"> here</a> to go back</p>';
?>[/code]
Result
Error! An error accured while the file was being uploaded. Error code: 1
or
Error! Failed to insert the file
Got a packet bigger than 'max_allowed_pa cket'
I got this cool tool from 'Howtos' posted by ATLI, but I'm having trouble on posting or uploading files bigger than 15000KB although I create the table field into a 'LongBlob'. Is there any other way to maximize the the field?
Script[code=php]
<?php
# Check if a file has been uploaded
if(isset($_FILE S['uploaded_file']))
{
# Make sure the file was sent without errors
if($_FILES['uploaded_file']['error'] == 0)
{
# Connect to the database
$dbLink = mysql_connect(" localhost","use r", "password")
or die("Error! Failed to connect to the MySQL server!");
mysql_select_db ("tablename" , $dbLink)
or die("Error! Failed to select a database!");
# Gather all required data
$name = mysql_real_esca pe_string($_FIL ES['uploaded_file']['name'], $dbLink);
$mime = mysql_real_esca pe_string($_FIL ES['uploaded_file']['type'], $dbLink);
$size = $_FILES['uploaded_file']['size'];
$author = $_POST['author'];
$requestor = $_POST['requestor'];
$description = $_POST['description'];
$data = mysql_real_esca pe_string(file_ get_contents($_ FILES ['uploaded_file']['tmp_name']), $dbLink);
# Create the SQL query
$query = "
INSERT INTO fileStorage (
FileName, FileMime, FileSize, FileData, Created, Author,
)
VALUES (
'{$name}', '{$mime}', {$size}, '{$data}', NOW(), '$author'
)";
# Execute the query
$result = mysql_query($qu ery, $dbLink);
# Check if it was successfull
if($result)
{
echo "Success! Your file was successfully added!";
echo "$author";
}
else
{
echo "Error! Failed to insert the file";
echo "<pre>". mysql_error($db Link) ."</pre>";
}
}
else
{
echo "Error!
An error accured while the file was being uploaded.
Error code: ". $_FILES['uploaded_file']['error'];
}
# Close the mysql connection
mysql_close($db Link);
}
else
{
echo "Error! A file was not sent!";
}
# Echo a link back to the mail page
echo '<p>Click <a href="cmr.php"> here</a> to go back</p>';
?>[/code]
Result
Error! An error accured while the file was being uploaded. Error code: 1
or
Error! Failed to insert the file
Got a packet bigger than 'max_allowed_pa cket'
Comment