Good day,
I need to upload an image to a DB, then save that data as a file. The first part is not too hard. I found a nice Class (Loader.asp) that does this for me:
With the image data stored in the DB, I want to write that data to a new file.
I need help understanding how to write the Binary data to the file system.
Again here is the process:
Image upload to DB (done)
Create/save a file of the image data in DB
The craetion of the image file needs to receive its data from the DB and not from the Form upload portion (the image may be created from the DB from time to time after it is stored).
Please, any help on understanding how to save stored data to a file would be great!
===========================
What I tried that failed:
Set rsFile=db.Execute("SELECT Data FROM File WHERE FileID=6"
objFileData = rsFile("Data"
conPathOnServer="D:\Images"
objFileName="test.jpg"
Set FSO = Server.CreateObject("Scripting.FileSystemObject"
Set objStaticFile = FSO.CreateTextFile(conPathOnServer & objFileName, true)
objStaticFile.Write objFileData
objStaticFile.Close
Set objStaticFile = Nothing
Set FSO = Nothing
This resulted in:
Invalid procedure call or argument
=========================================
Thanks all for your help.
I need to upload an image to a DB, then save that data as a file. The first part is not too hard. I found a nice Class (Loader.asp) that does this for me:
With the image data stored in the DB, I want to write that data to a new file.
I need help understanding how to write the Binary data to the file system.
Again here is the process:
Image upload to DB (done)
Create/save a file of the image data in DB
The craetion of the image file needs to receive its data from the DB and not from the Form upload portion (the image may be created from the DB from time to time after it is stored).
Please, any help on understanding how to save stored data to a file would be great!
===========================
What I tried that failed:
Set rsFile=db.Execute("SELECT Data FROM File WHERE FileID=6"
objFileData = rsFile("Data"
conPathOnServer="D:\Images"
objFileName="test.jpg"
Set FSO = Server.CreateObject("Scripting.FileSystemObject"
Set objStaticFile = FSO.CreateTextFile(conPathOnServer & objFileName, true)
objStaticFile.Write objFileData
objStaticFile.Close
Set objStaticFile = Nothing
Set FSO = Nothing
This resulted in:
Invalid procedure call or argument
=========================================
Thanks all for your help.