Signup · Login
Stardeveloper.com  
Home · Articles · Forums · Advertise · Contact
Article Categories
.NET  .NET
  ASP (15)
  ASP.NET (26)
  ADO (16)
  ADO.NET (10)
  COM (6)
  Web Services (4)
  C# (1)
  VB.NET (3)
  IIS (2)

J2EE  J2EE
  JSP (15)
  Servlets (9)
  Web Services (1)
  EJB (4)
  JDBC (4)
  E-Commerce (1)
  J2ME (1)
  Products (1)
  Applets (1)
  Patterns (1)
Latest Forum Activity
what is the right code to link the asp page t..
by amylisa on 22 Jul 2008 Go To Post

Can Loader.asp Get Form Elements
by azziham on 14 Jul 2008 Go To Post

Good asp resource sites
by codemylife on 3 Jul 2008 Go To Post

Re: Unable to insert data in an Access databa..
by asia on 3 Jul 2008 Go To Post

Re: problem with do while loop
by idsanjeev on 30 Jun 2008 Go To Post

Log In
UserName Or Email:

Password:

Auto-Login:

Miscellaneous Links
  Submit Article

Hosted by Securewebs.com
 
Home : .NET : ADO : Uploading Files into an Access Database using plain ASP
 

Uploading Files into an Access Database using plain ASP
by Faisal Khan.

Introduction
In this tutorial you are going to learn everything in detail step by step you'll ever want to know about inserting binary data ( images, zip files etc ) into database. This is actually first of the three articles I am going to write on manipulating binary data in the database. After this article you'll be able to upload binary data into database, then in the second article (Displaying Images from an Access Database using plain ASP) you'll learn to get this data out of database and display it as you like. Finally in the third article (Uploading Files to the Server Hard Disk using plain ASP) I'll explain uploading files. All of this is going to be plain ASP ( VBScript ) and nothing else, so stay tuned.

File Uploading with ASP.NET
If you have the privilege of using ASP.NET then you should read these comprehensive tutorials regarding file uploading using built-in ASP.NET server controls:

  1. File uploading to server hard disk.
  2. File uploading to Microsoft Access database.
  3. Uploading images, determining size, width & height and resizing image files.

Requirements
You should be able to run ASP pages, this is all that is required. But due to older versions of VBScript runtime on some systems, it is recommended that you download and install latest version of VBScript runtime from here. If you don't do this and get an error then download the latest runtime and it should work!

Why store binary data in database ?
Getting binary data in and out of databases is expensive, expensive in terms of server resources and time it takes for it. But having said that it is very convenient and in some cases extremely important to save all kind of data at a central place e.g, an ad server. You can then build some custom ASP pages that retrieve data out of database and keep them in temporary folders on the hard disk and display them when needed, then after some expiry time they can refresh that file with new one from the database. Possibilities are endless.

What will you need ?
All we are going to use is plain simple ASP. The database that I've chosen is Microsoft Access database. I could have explained it on Microsoft SQL Server but I chose Access because it is inexpensive and widely available. Transition form Access to SQL Server is very easy.

Creating Access Database
Start Microsoft Access database and create a new database. Save it as 'FileDB.mdb' in a safe folder. Now create a new table in design view and save it as 'Files'. The structure of this table should look like following where 'ID' is the primary key :

Files - Table
Files - Table

Creating Loader class
Now open your note pad ( or any other ASP editor you use ) and create a new file. Save it as 'Loader.asp'. Now copy the text listed below and paste it in to the newly created 'Loader.asp' page and hit the save button :


 ( 3 Remaining ) Next

Comments/Questions ( Threads: 104, Comments: 212 )
    Contains 1 or more replies by the Author of this Article.
    Contains 1 or more replies by Faisal Khan.

  1. Uploading Files into an Access Database using plain ASP
  2. Uploaded PDF files keep asking to
  3. Displaying the image
  4. Error in Line 104 in Insert.Asp
  5. Fantastic Script!!!!!
  6. vb.net ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  7. ASP
  8. Cannot update. Database or object is read-only.
  9. Error when passing multiple list values
  10. Increasing Max File Size
  11. HTTPS
  12. Retrieve binary data an saving into a folder from DB using asp
  13. Deleting Files
  14. insert exist image on server to database
  15. Solution for error: ADODB.Recordset error '800a0cc1'
  16. Huge File Upload?? up to 2GB?? ( 1 Reply )
  17. Nice.. but.. I found out that some JPEG files are incomplete. ( 1 Reply )
  18. INSERT.asp ERROR (Image DB upload) ( 1 Reply )
  19. Making file upload unrequired ( 1 Reply )
  20. about calendar in asp.net
  21. Setting file names on saving.
  22. Size of the image uploaded to the SQL database ( 2 Replies )
  23. Downloading data from a database
  24. Large images are not displayed ( 1 Reply )
  25. JPG Files won't upload ( 1 Reply )
  26. How to load many files at a time ???
  27. Upload without using the FileSystemObject ( 1 Reply )
  28. Posting other Binary data problems ( 4 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  29. tried the insert image but... ( 3 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  30. Error Using
  31. Excellent info. Thanks...
  32. Help using this with MySQL
  33. Please Help!!!
  34. How could I upload files from a certain folder (not manual selection)?
  35. Using Oracle ( 1 Reply )
  36. using sql stored procedure to upload file ( 2 Replies )
  37. How can I download the files as the same file name as they were uploaded. ( 1 Reply )
  38. !! UPDATING BINARY DATA !! ..HELP
  39. My images get uploaded but cannot be displayed...help ( 1 Reply )
  40. file names ( 1 Reply )
  41. duplicate file names
  42. Multiple Image Files (very important)
  43. insert images into DB as link? ( 1 Reply )
  44. Defaulting files
  45. The page cannot be displayed on insert.asp ( 3 Replies )
  46. Upload MS-Word documents into an access database
  47. Error please hellllup
  48. form data not coming in
  49. about zipping the size of binary object
  50. Upload text fields without binary data ( 2 Replies )
  51. Server error: Unable to retrieve schema information
  52. SQL syntex for upload imag file to MySQL ( 2 Replies )
  53. txt and asp files
  54. Translated appendchunk method looses odd byte, results in partial data or corruption
  55. Truncated jpeg images with odd byte size
  56. Cannot read array of inputs
  57. Wrong data size in Access db ( 3 Replies )
  58. It was a great help!!!
  59. Inserting Images ( binary data ) into Database ( 2 Replies )
  60. Inserting Images ( binary data ) into Database
  61. No File was Selected
  62. Reading Image from database
  63. Zip Files error ( 5 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  64. Overwriting/updating existing fields ( 2 Replies )
  65. Getting Page Cannot be displayed error message ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  66. Limit image size through maximizing width and Heigth ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  67. Great Code! ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  68. Changing binary pictures in existing database ( 2 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  69. Images do not upload!!!
  70. Having troubles with inserting images ( 3 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  71. First Class Tutorial ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  72. Upload files to server hard disk
  73. Can i Upload 2 Images at one time?
  74. Invalid procedure call or argument: 'MidB' ( 3 Replies )
  75. 'ASP 0177 : 800a01c9'
  76. How to Update Images ( binary data ) into Database ( 3 Replies )
  77. Upload to database Where ID = ( 2 Replies )
  78. gives me error when i try to open the binary file from access ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  79. resizing images ( 2 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  80. uploading multiple files
  81. Categorizing Files ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  82. My images get uploaded but cannot be displayed...help ( 4 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  83. how to see the uploaded file (pls help) ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  84. how about using oracle database when storing binary data ( 2 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  85. Can ASP & ORACLE WORK TOGETHER ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  86. How to delete? ( 3 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  87. error when there is no file being uploaded ( 2 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  88. Limiting File size and file type ( 3 Replies )
  89. inserting and displaying images in ASP.NET
  90. inserting image in database
  91. Displaying the Image!!!!! ( 4 Replies )
  92. Using MySQL ( 2 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  93. need some clarification ( 2 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  94. Loader.asp ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  95. Tutorial !!!!!! ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  96. Error: Cannot update. ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  97. Passing Parameters to the upload page. ( 2 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  98. SQL Dbase ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  99. Database ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  100. Uploading status bar ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  101. Height & Width ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  102. 0x80004005 ( 3 Replies ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.
  103. Excellent Tutorial ( 7 Replies ) This thread contains 3 replies by the Author of this Article. This thread contains 3 replies by Faisal Khan.
  104. securing access database ( 1 Reply ) This thread contains 1 reply by the Author of this Article. This thread contains 1 reply by Faisal Khan.

Post Comments/Questions

In order to post questions/comments, you must be logged-in. If you are not a member yet, then signup, otherwise login. Once you login then come back to this page and you'll see a form right here which will allow you to post comments/questions.

Please note, one of the benefits of signing up is to be notified immediately by email everytime you receive a reply to the thread you have subscribed.

 
© 1999 - 2008 Stardeveloper.com, All Rights Reserverd.