Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · ASP.NET Newsletter Application · Web Hosting Plans · Faisal Khan's Blog · Contact
Search Stardeveloper.com
Newsletter
Enter your email address to receive full length articles at Stardeveloper:


Article Categories
.NET  .NET
  ASP (16)
  ASP.NET (43)
  ADO (16)
  ADO.NET (11)
  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)

Main Category  Other
  Website Maintenance (3)
Log In
UserName Or Email:

Password:

Auto-Login:

Hosted by Securewebs.com
 
Home : .NET : ADO : Uploading Files into an Access Database using plain ASP
 
Read full length articles at Stardeveloper using Twitter Follow on Twitter Facebook Facebook fan page Email Get Articles via Email RSS Get Articles via RSS Feed

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: 105, Comments: 213 )
    Contains 1 or more replies by the Author of this Article.
    Contains 1 or more replies by Faisal Khan.

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