troubleshooting Question

ASP Upload (using Persits ASPUpload) error when uploading from UNC Paths.

Avatar of electricd7
electricd7 asked on
9 Comments1 Solution1146 ViewsLast Modified:

I am using ASP Upload to insert files into a SQL 2000 database via an ASP form.  It works fine when uploading files which are stored on the same computer which is being used to access the form, but when I try and upload files via a UNC path from a shared computer.  The error I get is below:

Error saving the file: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error

The source from the ASP page (at least the section which does the work) is as follows:

Set Upload = Server.CreateObject("Persits.Upload")

if request("CN") <> "" then
     CN     = request("CN")
     Upload.Save "C:\temp"
     CN = Upload.form("cn")
end if
if Upload.form("upd") = "1" then
      Set File = Upload.Files("FileContent")

     if not File is nothing then
     FileType = Upload.form("FileType")
     if Upload.Form("description") = "" then description = "NULL" else description = "'"&RmAps(Upload.Form("description"))&"'"
          sqlStmt = "insert into Files (CN, Date, CreatedBy, Description, FileName, FileType, FileSize, FileContent) values "&_
                    "(" & CN & "," &_
                    " getdate(), " &_
                    "1, " &_
                    ""&description&", " &_
                    "'" & File.extractfilename & "', " &_
                    ""&FileType&", " &_
                    "" & File.Size & ", " &_
          on error resume next
          File.ToDatabase Application("Conn"), SqlStmt
          if Err <> 0 Then
               Response.Write "<font color=RED>Error saving the file: " & Err.Description & "</font><br>"
               response.write "<script>"
               response.write " (""c.asp?cn="&cn&""", 'Main_App')"
               response.write "</script>"
          end if    

          response.write "<font color=RED>ERROR - FILE NOT UPLOADED.</font><br><br>Please try again."
     end if          
end if

Thanks for help in advance!

BTW there is another question exactly like this one from me that you can get points from if you answer this one right!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros