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("Persi ts.Upload" )
strDataPath = "c:\test\aspupload.mdb"
strConnectString = "Provider=Microsoft.Jet.OL EDB.4.0;"_
+ " Data Source= " & strDataPath & ";"_
+ " Mode=Share Deny None;User Id=admin;PASSWORD=;"
set Conn=Server.CreateObject(" ADODB.Conn ection")
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
%>
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("Persi
strDataPath = "c:\test\aspupload.mdb"
strConnectString = "Provider=Microsoft.Jet.OL
+ " Data Source= " & strDataPath & ";"_
+ " Mode=Share Deny None;User Id=admin;PASSWORD=;"
set Conn=Server.CreateObject("
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
%>
I think this
File.ToDatabase strDataPath, strConnectString, SQL
should be like this
File.ToDatabase strDataPath, Conn, SQL
File.ToDatabase strDataPath, strConnectString, SQL
should be like this
File.ToDatabase strDataPath, Conn, SQL
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks i'll try the code
ASKER
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
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
ASKER
Hi Gladxml:
I figured the problem out. I'll give you the points since you helped me and gave me food for thought.
Dan
I figured the problem out. I'll give you the points since you helped me and gave me food for thought.
Dan
ASKER
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...
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...
Conn.close
end if
should this if statement be "if Conn.state" or " if Conn.mode"?