Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 633
Product
FileUp
Title
HowTo: Save to File System and Database
Problem
When trying to save a file to both the file system and a relational database using FileUp, the file is only saved to either the filesystem or the database.

This happens because FileUp's Save methods (Save, SaveAs, SaveAsBlob, SaveInVirtual) can only be called once. If you try to save twice, the file will be moved to the last specified location, depending on the order of the method calls.

However, it is easy to save a file to both the filesystem and a database by using FileManager together with FileUp.

Solution
SoftArtisans FileManager is a robust file management component that comes bundled free with FileUp.

First call the Save method of the FileUp object, and subsequently call FileManager's ExportToBlob method to export the file from the file system to the database.

You can pass the path of the uploaded file to the ExportToBlob method using FileUp's ServerFilename property.

for example:

objFileManager.ExportToBlob objFileUp.Form("file1").ServerFilename, objRS.Fields("FileBinary")

More about ExportToBlob and FileManager can be found here: FileManager's ExportToBlob method

Please see attached file for a sample.

Attachments
Attachments/KB633_files1.zip
Created : 5/23/2003 12:06:45 PM (last modified : 5/23/2003 12:06:42 PM)
Rate this article!
 
Comments