Jump to content

save and load File in Database: Has someone a Demo??


erich.wanker

Recommended Posts

Hello,

please can someone help me with this "basic" question?

  • i want to save a file with Fileupload in a database (BLOB Field of Firebird SQL Server)
  • and i want to send file from Database to Client..

Has someone a example - how to do that ?

 

AND: how can i Signature any document - before i store it in Database ( i must make a auditable System )

 

ThanX for help

Erich

Link to comment
Share on other sites

Hello,

https://stackoverflow.com/questions/29292596/save-load-objects-as-blob-in-a-database

If I were you, I'm not save file to db. Make a folder, (I have not new version unigui) fileupload component saving file on server side. After saved this file move & rename it. then transfer file that from folder. Just save name and path to db. This is much better way.

regards.

Link to comment
Share on other sites

  • 3 weeks later...
On 1/15/2020 at 10:50 AM, Freeman35 said:

Hello,

https://stackoverflow.com/questions/29292596/save-load-objects-as-blob-in-a-database

If I were you, I'm not save file to db. Make a folder, (I have not new version unigui) fileupload component saving file on server side. After saved this file move & rename it. then transfer file that from folder. Just save name and path to db. This is much better way.

regards.

I totally agree to Freeman35's post - Putting big files into a database makes everything slow and a backup of such a huge DB can become a nightmare!
As already recommended, please put only file references to the DB.

Link to comment
Share on other sites

On 1/15/2020 at 5:40 PM, erich.wanker said:

Hello,

please can someone help me with this "basic" question?

  • i want to save a file with Fileupload in a database (BLOB Field of Firebird SQL Server)
  • and i want to send file from Database to Client..

Has someone a example - how to do that ?

 

AND: how can i Signature any document - before i store it in Database ( i must make a auditable System )

 

ThanX for help

Erich

Are you using FireDAC for connect Firebird Server?

Link to comment
Share on other sites

Someone Save files into database and someone save files in folders,

They are all right.

But the new problem is :

if your project run in cluster servers,

If your folders are not cluster, and your database are clusters,you should select save files in database.

If your folders are cluster,and your database are not cluseters,you should select save files in folders.

Most of all ,is the  stabilization

Link to comment
Share on other sites

True ... every variant has its advantages and disadvantages. When you apply clustering, I can also assume
that the database environment is also clustered. You can use load balancers for high availability and realize redancy.

By using virtualization in combination with hyperconverged or converged server and storage platform,
you can now build beautiful, stable and fast systems.

Link to comment
Share on other sites

  //insert into myfiletable values(0, :date, :filename, :file);
  with SaveFileQuery do begin
    paramByName('date').AsDateTime:=now;
    paramByName('filename').AsInteger:=uniFileUpload1.fileName;

    try
      blob := TMemoryStream.Create;
      blob.Seek(0, soFromBeginning);
      try
        blob.loadFromFile(myFileName);                      //if you have the file on disc
        myFastReport.SaveToStream(blob, true, true, false); //if you need to save a PDF report
      finally
      end;
    finally
      paramByName('file').LoadFromStream(blob, ftBlob);                   //if you use any of the above options
      paramByName('file').LoadFromStream(uniFileUpload1.stream, ftBlob);  //if you have not saved the file yet
      ExecSQL;
      blob.Free
    end;
  end;

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...