I think this is probably some minor oversight on my end but I'm just missing it.
I have a multipart/form-data form in a ASP page. Inside the form I have traditional text fields and a upload field for uploading images to a server.
The intent is to store the image name (not the image itself) along with corresponding data in a SQL Server database.
The problem I'm currently having is that the upload is working correctly but it is not writing any data into the database. The page does not report an error it just simply does not write. It's like the page the form submits to isn't getting the data from the form because nothing is in the fields when I do a
.
Here's the code. Any help is greatly appreciated.
I have a multipart/form-data form in a ASP page. Inside the form I have traditional text fields and a upload field for uploading images to a server.
The intent is to store the image name (not the image itself) along with corresponding data in a SQL Server database.
The problem I'm currently having is that the upload is working correctly but it is not writing any data into the database. The page does not report an error it just simply does not write. It's like the page the form submits to isn't getting the data from the form because nothing is in the fields when I do a
Code:
response.write
Here's the code. Any help is greatly appreciated.
Code:
Title = Request("Title") ShortTitle = Request("ShortTitle") SubmittedBy = Request("SubmittedBy") StoryDate = Request("StoryDate") StoryEndDate = Request("StoryEndDate") Story = Request("Story") 'Response.Write story if instr(1,Story,"<P>") = 1 then Story = mid(Story,4,len(Story)) end if Set StrConnection = Server.CreateObject("ADODB.Connection") Set StrRecordSet = Server.CreateObject("ADODB.Recordset") StrConnection.Open "Provider=MSDASQL;Driver={SQL Server};SERVER=FF-CORPSQL;DATABASE=testannouncements;uid=intranet;pwd=reltd;" StrSql = "SELECT * FROM announcements;" StrRecordSet.Open StrSql, StrConnection,1,2 if Title <> "" then with StrRecordSet .AddNew Title= Replace(Title, "'", "^") StrRecordSet("Title")=Title ShortTitle= Replace(ShortTitle, "'", "^") StrRecordSet("ShortTitle")=ShortTitle SubmittedBy= Replace(SubmittedBy, "'", "^") StrRecordSet("SubmittedBy")=SubmittedBy StoryDate= Replace(StoryDate, "'", "^") StrRecordSet("StoryDate")=StoryDate 'StoryEndDate= Replace(StoryEndDate, "'", "^") if StoryEndDate <> "" then StrRecordSet("StoryEndDate")=StoryEndDate end if Story= Replace(Story, "'", "^") StrRecordSet("Department") = Request("Department") StrRecordSet("Story")=Story 'if filename = "" then ' If Request("StoryPic") <> "None" then ' StrRecordSet("picture")=Request("StoryPic") ' end if 'else ' StrRecordSet("picture")=filename 'end if .Update end with end if set strrecordset = nothing StrConnection.Close set StrConnection = nothing %> <!--#include file="upload.asp" --> <% Dim Uploader, File, ErrMsg Set Uploader = New FileUploader ' This starts the upload process Uploader.Upload() '****************************************** ' Use [FileUploader object].Form to access ' additional form variables submitted with ' the file upload(s). (used below) '****************************************** ' Check if any files were uploaded If Uploader.Files.Count = 0 Then ' Response.Redirect("add_news.asp") Else ' Loop through the uploaded files For Each File In Uploader.Files.Items ' Check where the user wants to save the file If Uploader.Form("saveto") = "disk" Then ' Save the file File.SaveToDisk strDISKLOCATION End If Dim filename filename = File.FileName '& "<br>" Next End If
Comment