Link to home
Start Free TrialLog in
Avatar of RecipeDan
RecipeDan

asked on

Persits ASP Upload

I am testing this script to upload files from ASP. I get the following error

Persits.Upload.1 error '800a0018'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/odbc_upload.asp, line 37



<%
Dim Conn, strDataPath, strConnectString, strSQL
Set Upload = Server.CreateObject("Persits.Upload")
strDataPath = "c:\test\aspupload.mdb"
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
          + " Data Source= " & strDataPath & ";"_
          + " Mode=Share Deny None;User Id=admin;PASSWORD=;"
set Conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionTimeout = 15
Conn.CommandTimeout =  10
Conn.Mode = 3

if Conn.state = 0 then
     Conn.Open strConnectString
end if

      ' Capture files
      Upload.Save "c:\test\aspupload.mdb"

      ' Obtain file object
      Set File = Upload.Files("THEFILE")
 ' Build SQL INSERT statement
  SQL = "INSERT INTO MYIMAGES(image_blob, filename, description, filesize) VALUES(?, '"
  SQL = SQL & File.Filename & "', '"
  SQL = SQL & Replace(Upload.Form("DESCR"), "'", "''") & "', "
  SQL = SQL & File.Size & ")"

  ' Save to database
  File.ToDatabase strDataPath, strConnectString, SQL
   
            ' Save to database
            File.ToDatabase strDataPath, SQL
            Response.Write "File saved."
if IsObject("Conn") then
     if not Conn is Nothing Then
          if Conn <> 0 then
               Conn.close
          end if
          set Conn = Nothing
     end if
end if
%>
Avatar of jrram
jrram
Flag of United States of America image

         if Conn <> 0 then
               Conn.close
          end if

should this if statement be "if Conn.state" or " if Conn.mode"?
Avatar of gladxml
gladxml

I think this

File.ToDatabase strDataPath, strConnectString, SQL

should be like this

File.ToDatabase strDataPath, Conn, SQL
ASKER CERTIFIED SOLUTION
Avatar of gladxml
gladxml

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RecipeDan

ASKER

Thanks i'll try the code
I am getting this error

Line 17 is     Upload.Save "c:\test\aspupload.mdb"



Persits.Upload.1 error '800a0005'

The system cannot find the path specified.

/odbc_upload.asp, line 17
try to check out the link might help...

http://support.persits.com/show.asp?code=PS02011784
Hi Gladxml:

I figured the problem out. I'll give you the points since you helped me and gave me food for thought.

Dan
Please note that the accepted answer is not the correct answer.
Why a grade of C?

try to check out the link regarding the right grade to give.
https://www.experts-exchange.com/help.jsp#hi73

Also it would be best the solution here so that other might use it for reference.  

Happy programming...