ASPUpload SaveVirtual

Results 1 to 3 of 3

Thread: ASPUpload SaveVirtual

  1. #1
    BRBYRD Guest

    Default ASPUpload SaveVirtual

    I&#039m attempting to allow registered users to post text and photos to a sql server table. My server will only allow saving to a virtual directory and I can&#039t get the aspUpload example to operate. Here&#039s the code:<BR><BR>&#060;%<BR> Set Upload = Server.CreateObject("Persits.Upload.1")<BR> Upload.SaveVirtual "UploadedFiles"<BR><BR> &#039 Save to the database using the ToDatabase method.<BR> &#039 SQL Server table creation script can be found in DatabaseCreateTables.sql<BR><BR> On Error Resume Next<BR> For Each File in Upload.Files<BR> File.ToDatabase "DSN=texas;UID=sa;PWD=mra;",_<BR> "insert into images(filename, photo) values(&#039 " & File.Path & " &#039, ?)"<BR> if Err &#060;&#062; 0 Then<BR> Response.Write "Error saving the file: " & Err.Description<BR> Else<BR> File.Delete<BR> Response.Write "Success!"<BR> End If<BR> Next<BR>%&#062;<BR>The error code is:<BR>Error saving the file: [Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would be truncated<BR>I&#039m too old for this!

  2. #2
    Join Date
    Dec 1969

    Default RE: ASPUpload SaveVirtual

    This usually means that the SQL field does not have enough characters specified. For example your "filename" field may be a varchar(30) but the string content probably has above 30 characters. Just increase the Varchar() in SQL you should be able to do this without affecting any current data.<BR><BR>Hope this helps <BR><BR>Dwane

  3. #3
    BarryB Guest

    Default RE: ASPUpload SaveVirtual

    Works like a charm- now I have a new quandry which I posted- Thanks a bunch!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts