Re: [PHP] How to store a file into MSSQL?

This is a discussion on Re: [PHP] How to store a file into MSSQL? within the PHP General forums, part of the PHP Programming Forums category; I just use a TEXT field, and am doing so with 25k images, without issue. On Tue, 2003-07-15 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-16-2003
Adam Voigt
 
Posts: n/a
Default Re: [PHP] How to store a file into MSSQL?

I just use a TEXT field, and am doing so with 25k images,
without issue.


On Tue, 2003-07-15 at 18:45, Javier wrote:
> Hi everybody, I've trying to store a into a MSSQL Server (7 or 2k) using
> an example I found on the web (www.php.net).
>
> Is it possible that PHP (4.3.2) just store 4k of data? Because after
> inserting a test image with:
>
> $oDatos is an object that handles queries.
>
> // storing a file
> $datastring = join('',file("logo2.jpg"));
> $data = unpack("H*hex", $datastring);
> $oDatos->query( "insert into temp_test (test) values ( 0x" . $data['hex']
> .")" );
>
> A select will return a 4K file. Is it possible?
>
> $row = $oDatos->getData("select test from temp_test");
> //file://$row = mssql_fetch_assoc($result);
> $fp = fopen('copy.jpg','w');
>
>
> So... is there anyway to store a file that it is larger than 4K? Or am I
> missing something? :)
>
> Thanks.
>
> --
> *** s2r - public key: (http://leeloo.mine.nu/s2r-gmx.sig)

--
Adam Voigt (adam@cryptocomm.com)
Linux/Unix Network Administrator
The Cryptocomm Group

Reply With Quote
  #2 (permalink)  
Old 07-16-2003
John Manko
 
Posts: n/a
Default Re: [PHP] How to store a file into MSSQL?

Look here
http://www.mysql.com/doc/en/BLOB.html

Actually, if you don't care if the images can be view from outside the
DB, you can do what I do.
I simplely put the name of the file in a varchar field, then let the
browser do the work for you.
This is good for files that are referenced from multiple entries (ie,
individual products each referencing the same series image)
but, blob can work fine.


Adam Voigt wrote:

>I just use a TEXT field, and am doing so with 25k images,
>without issue.
>
>
>On Tue, 2003-07-15 at 18:45, Javier wrote:
>
>
>>Hi everybody, I've trying to store a into a MSSQL Server (7 or 2k) using
>>an example I found on the web (www.php.net).
>>
>>Is it possible that PHP (4.3.2) just store 4k of data? Because after
>>inserting a test image with:
>>
>>$oDatos is an object that handles queries.
>>
>> // storing a file
>>$datastring = join('',file("logo2.jpg"));
>>$data = unpack("H*hex", $datastring);
>>$oDatos->query( "insert into temp_test (test) values ( 0x" . $data['hex']
>>.")" );
>>
>>A select will return a 4K file. Is it possible?
>>
>>$row = $oDatos->getData("select test from temp_test");
>>//file://$row = mssql_fetch_assoc($result);
>>$fp = fopen('copy.jpg','w');
>>
>>
>>So... is there anyway to store a file that it is larger than 4K? Or am I
>>missing something? :)
>>
>>Thanks.
>>
>>--
>>*** s2r - public key: (http://leeloo.mine.nu/s2r-gmx.sig)
>>
>>



Reply With Quote
  #3 (permalink)  
Old 07-16-2003
Javier
 
Posts: n/a
Default Re: [PHP] How to store a file into MSSQL?

xerid@adelphia.net (John Manko) wrote in
news:3F155024.3010103@adelphia.net:

Does it apply also to MSSQL = Microsoft SQL Server?

> Look here
> http://www.mysql.com/doc/en/BLOB.html
>
> Actually, if you don't care if the images can be view from outside the
> DB, you can do what I do.
> I simplely put the name of the file in a varchar field, then let the
> browser do the work for you.
> This is good for files that are referenced from multiple entries (ie,
> individual products each referencing the same series image)
> but, blob can work fine.


>




--
*** s2r - public key: (http://leeloo.mine.nu/s2r-gmx.sig)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:09 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0