Re: Re: Can't upload files > then 400K to MySQL
| From: | ahmetax | Date: | Thu, 01 Jan 2004 13:37:06 +0000 |
| Subject: | Re: Re: Can't upload files > then 400K to MySQL | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173595@lists.php.net to get a copy of this message | ||
You're right Jeremy. I found that the limitation was because of default
max_packet_size of MySQL.
It was limited to 1MB by default. Also I found that 400K of data reached the
1MB boundary, when I applied
urlencode function to it.
Maybe, Chris has a similar limitation problem.
--
Ahmet Aksoy
www.axtelsoft.com
"Jeremy Johnstone" <jsjohnst@altdns.net> wrote in message
news:1072750966.2821.23.camel@lsuse9.33j.net...
> Might want to check the MySQL configuration. The max allowed packet size
> might be set extremely low.
>
> -Jeremy
>
> On Mon, 2003-12-29 at 15:25, Chris wrote:
> > Have you taken a look at the post below: Can't upload files Greater than
> > 11KB?
> > We may have the same problem.
> >
> >
> > "Ahmetax" <ahmetax@axtelsoft.com> wrote in message
> > news:20031228111514.61858.qmail@pb1.pair.com...
> > > Hi,
> > >
> > > I have the following PHP code to upload files to a MySQL table.
> > >
> > > It works fine, but, I can't upload any files greater then 400K.
> > >
> > > What might be the problem?
> > >
> > > TIA
> > >
> > > ahmet
> > >
> > > <?
> > > if (isset($_POST["submit"]))
> > > {
> > > $fname= $_FILES["user_file"]["name"];
> > > $tmp= addslashes($_FILES["user_file"]["tmp_name"]);
> > > $size= $_FILES["user_file"]["size"];
> > > $type=$_FILES["user_file"]["type"];
> > > $tanim=$_FILES["user_file"]["file_desc"];
> > > $fd=fopen($tmp,"r") or die("Can't open file!");
> > > $fdata=urlencode(fread($fd,filesize($tmp)));
> > > $size=filesize($tmp);
> > > $tanim=$descript;
> > > include("baglan.inc");
> > >
> > > mysql_select_db("dosyalar");
> > > $sql="INSERT INTO files
(name,file_type,file_desc,file_data,file_size)".
> > > "
> > > VALUES('$fname','$type','$descr','$fdata','$size')";
> > > mysql_query($sql);
> > > }
> > > ?>
> > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> > > <html>
> > > <head>
> > > <title>AxTelSoft-Uploading a file </title>
> > > <meta http-equiv="Content-Type" content="text/html;
charset=windows-1254">
> > > <meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-9">
> > > <meta http-equiv="Content-Language" content="tr">
> > > <meta http-equiv="description" content="axtelsoft, indir, download,
> > delphi,
> > > source code, kaynak kod">
> > > <meta http-equiv="Pragma" content="no-cache">
> > > <meta name="Generator" content="Ahmet Aksoy">
> > > </head>
> > > <body>
> > >
> > > <form enctype="multipart/form-data" action="<?php echo
> > > $SERVER["PHP_SELF"];?>" method="post">
> > > <input type="hidden" name="MAX_FILE_SIZE"
> > > value="16777215">
> > >
> > > Send this file: <input name="user_file" type="file">
> > > Explanations : <TEXTAREA NAME="descript" ROWS=10 COLS=45
> > > WRAP><?php
> > > echo($descr);
> > > ?></TEXTAREA>
> > > <P><input type="submit" value="Send File"
> > > name="submit">
> > > </form>
> > >
> > > </body>
> > > </html>