Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload file to SQL database using classic ASP

I am trying to upload files (.doc/.pdf) to a SQL database (2005) but I am really struggling to find any step by step guides.

This is what happens on my ASP form:

  • User selects a document
  • Document is currently upload to a temp file and sent to a email address

However it also needs to be stored within a database field.

I have set the field type within the database to Image. But I am unsure about how I save the binary data information when all I really have is a link to the document (for example C://) from the user.

I also want to be able to download this document at a later date, this is also possible?

Thank you in advance for any help.

Thanks Clare


2 Answers

Definately, use freeaspupload to upload the file. It's pretty easy to use. Once you get the file uploaded you will need to binary read the file and then write that binary stream to your db. This website seems to have a working example of what you are trying to do. Look at the code and figure out what parts you need.

like image 135
Davin Studer Avatar answered Mar 07 '26 20:03

Davin Studer


(Storing binary data in a database is usually a bad idea.)

Classic ASP doesn't have built-in support for file upload, so you need a upload compontent on the server. For most parts, there are samples included with the upload component that shows how to upload directly into a database.

like image 29
Svante Svenson Avatar answered Mar 07 '26 20:03

Svante Svenson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!