php - BLOB Download Truncated at 1 MB Script Works for Files Less Than 1 MB -


I have just asked recently and have solved a question related to uploading PDF files which is more than 2 MB , Which is the Blobes in a MySQL database. I had to change some settings in my php.ini file and MySQL maximum packet setting. However, deciding this issue has helped me find a new issue with my script.

Now since I can upload files to my Blob database, I tried to download the file for testing purposes when I went to open the PDF file, so I was very disappointed. I got the following error: Failed to load document (error 3) 'file: ///tmp/test-13.pdf' After further investigation I found that the file is being downloaded, test.pdf, only 1 MB , Which is slightly less than half of its size in the database of slightly more than 2 MB, it is obviously the cause of error.

The following part of the code is part of my script which I downloaded files from the database I'm using to It is at the top of the script and works flawlessly for files less than 1 MB ($ _ $ $ key as request = key => $ Value) {if ($ value == 'Open') {header (); Session_start (); $ Dbh = new PDO ('mysql: host ='. $ _ Session ['osdbbusar'] .. Ops.tns.its.psu.edu; dbname = '. $ _ Session [' opsdb '], $ _SESSION [' Yum '], $ _SESSION [' AMA ']); $ Id = $ key; Download $ Sql ​​= "Select name, type, content, size upload WHERE id = '" $ id "'"; $ Result = $ dbh- & gt; Query ($ sql download); $ Download = $ result-> Fatch ALL (); $ Type = $ download [0] ['type']; $ Size = $ download [0] ['size']; $ Name = $ download [0] ['name']; $ Content = $ Download [0] ['Content']; Header ("content-type: $ type"); Header ("content-dispute: inline; filename = $ name"); Header ("content-length: $ size"); Header ("cache-control: macque = 1"); Header ("PAGMA: public"); Counterpart $ content; Go out; }}

I think that I may have some header details incorrect? I am very confused about what to do. I have searched through php.ini and I have not got any settings which I think I need to change and my max packet setting for MySQL is 4 MB, so Should download 2 MB.

Thanks for any help.

According to ():

A BLOB or TEXT object The maximum size is determined by this type, but the biggest value you actually transmit between the client and the server is determined by the amount of available memory and the size of the communication buffers. You can change the message buffer size by changing the value of the max_allowed_packet variable, but you should do this for both server and your client program. According to

the default value for Max_allowed_packet is 1048576.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -