Re: [PHP] storing files in database and retriving them

2010-07-28 Thread Dušan Novaković
Ok, I found the problem :-) There was nothing wrong with storing or sending files, it's just that I tried to load file with jQuery on wrong way :-( Sorry once more to everyone :-( Dusan 2010/7/28 Dušan Novaković : > Hi, > > Here are headers: > > Response Headers > --

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Dušan Novaković
Hi, Here are headers: Response Headers DateWed, 28 Jul 2010 06:41:33 GMT Server Apache/2.2.14 (Ubuntu) X-Powered-ByPHP/5.3.2-1

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Nilesh Govindarajan
Dude! I found the bug probably, you're using fopen() in 'r' mode which is meant to read ASCII text. Since PDF is a binary file (probably?), you should use binary mode. Try with mode = 'rb' in fopen(). -- Regards, Nilesh Govindarajan Facebook: http://www.facebook.com/nilesh.gr Twitter: http://twit

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Richard Quadling
2010/7/27 Dušan Novaković : > I don't think that it will help :-( I've tried to set different > headers but still I end up with some strange response, like: > > %PDF-1.3 > 3 0 obj > < /Parent 1 0 R > /Resources 2 0 R > /Contents 4 0 R>> > endobj > 4 0 obj > <> > stream > > > So, if we try to l

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Dušan Novaković
I don't think that it will help :-( I've tried to set different headers but still I end up with some strange response, like: %PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream So, if we try to look into this problem as basic. For example, I'm trying to store file test.pdf from some location on ser

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Pete Ford
On 27/07/10 14:16, Peter Lind wrote: 2010/7/27 Nilesh Govindarajan: 2010/7/27 Dušan Novaković: Hello, so when I'm sending the array to model it's like this: $fp = fopen(INVOICE_PATH.date('Y-m-d').DS.$pdfName, "r"); $pdfContent = array( 'file

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Richard Quadling
2010/7/27 Dušan Novaković : > hello, > > I have some problems with storing files in db and retriving them, so > probably I'm doing something wrong :-) > Here is the case: > I have on one of the pages request to generate some PDF files and > store them in database. So, I use FPDF to create files, an

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Peter Lind
2010/7/27 Nilesh Govindarajan : > 2010/7/27 Dušan Novaković : >> Hello, >> >> so when I'm sending the array to model it's like this: >> >> $fp = fopen(INVOICE_PATH.date('Y-m-d').DS.$pdfName, "r"); >> $pdfContent             = array( >>                                        'file'  =>       >> base

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Nilesh Govindarajan
2010/7/27 Dušan Novaković : > Hello, > > so when I'm sending the array to model it's like this: > > $fp = fopen(INVOICE_PATH.date('Y-m-d').DS.$pdfName, "r"); > $pdfContent             = array( >                                        'file'  =>       > base64_encode(fread($fp, > filesize(INVOICE_PA

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Peter Lind
2010/7/27 Dušan Novaković : > Hello Peter, > > I can't use files from filesystem. Let's say that they are not on the > some mashine where is application that has to show files :-) So it has > to be in exact order as I wrote :-( > That normally doesn't stop people (mounting filesystems across the n

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Dušan Novaković
Hello Peter, I can't use files from filesystem. Let's say that they are not on the some mashine where is application that has to show files :-) So it has to be in exact order as I wrote :-( 2010/7/27 Peter Lind : > 2010/7/27 Dušan Novaković : >> Hello, >> >> so when I'm sending the array to model

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Peter Lind
2010/7/27 Dušan Novaković : > Hello, > > so when I'm sending the array to model it's like this: > > $fp = fopen(INVOICE_PATH.date('Y-m-d').DS.$pdfName, "r"); > $pdfContent             = array( >                                        'file'  =>       > base64_encode(fread($fp, > filesize(INVOICE_PA

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Dušan Novaković
Hello, so when I'm sending the array to model it's like this: $fp = fopen(INVOICE_PATH.date('Y-m-d').DS.$pdfName, "r"); $pdfContent = array( 'file' => base64_encode(fread($fp, filesize(INVOICE_PATH.date('Y-m-d').DS.$pdfName))),

Re: [PHP] storing files in database and retriving them

2010-07-27 Thread Nilesh Govindarajan
Have you checked the headers? Its mostly a mime time issue I feel. What do you see in Content-Type? It should be application/pdf (or application/x-pdf, unsure) for PDF files. -- Regards, Nilesh Govindarajan Facebook: http://www.facebook.com/nilesh.gr Twitter: http://twitter.com/nileshgr Website:

[PHP] storing files in database and retriving them

2010-07-27 Thread Dušan Novaković
hello, I have some problems with storing files in db and retriving them, so probably I'm doing something wrong :-) Here is the case: I have on one of the pages request to generate some PDF files and store them in database. So, I use FPDF to create files, and that's working perfect. Then my system