How to insert file blob into sql database

db , sql server Orlando, United States
  • 13 years ago

    I would like to insert all different type of file into database and retrieve back. The user will upload file to database and dowload back for viewing if need.

    The data type is blob, here is my table:
    SQL> create table ICE (
    2 file_id raw(16) default sys_guid() primary key,
    3 file_content blob)
    4 /



    The problem is when I upload the file, the error message display and the file doesn't save in database.

    <cffile action="upload"
    filefield="form.FileName"
    destination="C:\temp\"
    nameconflict="makeunique"
    accept="application/octet-stream, application/vnd.ms-excel">

    <cffile
    action = "readbinary"
    file = "C:\temp\#cffile.serverFile#"
    variable="file_blob">

    <cfquery name="add" datasource="TEST">
    insert into TestFile (file_content)
    values (
    <cfqueryparam
    value="#file_blob#"
    cfsqltype="cf_sql_blob">















    How can I insert file into database using SQL Plus?

    Any help very appreciated.

     


     

     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only two kinds of languages: the ones people complain about and the ones nobody uses” - Bjarne Stroustrup