Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 2
Product
FileUp
Version
2.x
Title
Maximum Upload Size to a Database BLOB is 200 KB
Problem
When attempting to upload a file larger than 200KB to a database, an error of "Not enough storage is available to complete this operation." is sometimes reported. When uploading to a file, or if the upload is small, no error occurs.

Please note: The below solution applies to Microsoft Access as well as Microsoft SQL Server.

Solution
This is due to a known problem in ADO 1.5 (See Microsoft KB Article 182423). We recommend upgrading to MDAC 2 or later, which is available at http://msdn.microsoft.com/en-us/data/aa937730.

An alternate solution is to set the CursorLocation property to adUseClient (3). From the SA-FileUp samples (.\Samples\UploadToDatabase\Simple\formrespdb.asp), change the following lines if you are using SQL Server or Access:
'---
'--- Open a connection to the database. Note that the CursorType *must* be set 
'--- to adOpenDynamic (2) when adding binary (BLOB) type data.
'---
set rsBlob = Server.CreateObject("adodb.recordset")
'---rsBlob.Open "SimpleBlobTable", "AccessUpload", 2, 3
'--- 
'--- SQL Server users should use the following lines to open the recordset:
'---
' If ADO 1.5 or higher use client cursors
set cBlob = Server.CreateObject("ADODB.Connection")
If CSng(Left(cBlob.Version,3)) >= 1.5 Then
    rsBlob.CursorLocation = 3
End If
set cBlob = nothing


rsBlob.Open "SimpleBlobTable", "driver={SQL Server};server=<yourserver>;" + _ 
    "uid=sa;pwd=<yourpw>;database=<yourdatabase>", 2, 3

'---
'--- Add new record and update
'---
rsBlob.AddNew
upl.SaveAsBlob rsBlob.Fields("filecol")
rsBlob.Update
rsBlob.Close
Set rsBlob = Nothing 
Created : 12/1/2002 12:00:00 AM (last modified : 4/24/2012 4:06:11 PM)
Rate this article!
Comments