Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save Files to Server

Status
Not open for further replies.

nmath

Programmer
Dec 12, 2003
47
0
0
US
I inherited a DB where files were stored in a SQL Server 2000 database as images. I want to pull these out of the database and save them to the server as physical files. I am having trouble figuring out a way to do this. Now I can pull the data out of the DB and get it to open on my PC, but all my attempts to make it save directly to the server have failed. Here is my code that simply opens the file:

Code:
fsql = "select * from filelibrary.dbo.documents where did = 31"
set frs = conn.execute(fsql)

myfile = frs("binObj")
mymime = frs("mimeType")

    response.ContentType= mymime
    Response.AddHeader "Content-Disposition","inline; filename=Test.doc"
    Response.BinaryWrite(myfile)

That is just an example of one file - There are over 3000 files embedded in this SQL table so saving one by one and then moving them to the server is not really an option. I would like to simply be able to loop through and save each file to the server. Any ideas on how to do this would be GREATLY appreciated!!!

Thanks in advance!
 
How about just use adodb.stream to read the blob field and use .savetofile to save to disk? Practically an administrative script and all taking place on the server. There seems no reason to pass any of the data to the client. Then, loop over should not be a problem neither.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top