I can not upload big files to mysql
Posted by: songthit (203.81.72.---)
Date: July 06, 2008 11:43AM

<html>
<head>
<title>Upload File To MySQL Database</title>
</head>

<body>
<?
if(isset($_POST['upload']))
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp = fopen($tmpName, 'r');
$content = fread($fp, $fileSize);
$content = addslashes($content);
fclose($fp);

if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}


include 'config.php';
include 'opendb.php';

$query = "INSERT INTO upload (name, size, type, content ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";

mysql_query($query) or die('Error, query failed');
include 'closedb.php';

echo "<br>File $fileName uploaded<br>";
}
?>
<form action="" method="post" enctype="multipart/form-data" name="uploadform">
<table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
<tr>
<td width="246"><input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input name="userfile" type="file" class="box" id="userfile">
</td>
<td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>
</tr>
</table>
</form>
</body>
</html>

I used this upload script.
I can upload file that is less than 1mb.
When I upload big files, query failed.
my php config sis...
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
Please help me! sorry for my English.

Options: ReplyQuote
Re: I can not upload big files to mysql
Posted by: toivo (---.belrs3.nsw.optusnet.com.au)
Date: July 06, 2008 02:54PM

The 2MB sounds like the default setting of upload_max_filesize. Have you checked what the current values are by running phpinfo() from the browser ? The php config file should be c:\wamp\bin\apache2\apache2.2.8\php.ini.

On the other hand the limit might also be set in the include file config.php.

Regards,

toivo
Sydney, Australia

Options: ReplyQuote


Sorry, only registered users may post in this forum.