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. -
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
-
9 2771
First do a basic troubleshoot to see if the form data made it: - for each x in request.form
-
response.write x & ": " & request.form(x) & "<br>" & vbNewline
-
next
Try it and tell me what you get.
Jared
Sorry for the delay in my response.
I added the code and nothing is written
Sorry for the delay in my response.
I added the code and nothing is written
Then the form data is not being sent. post the code for your form.
Jared
I see that you are making requests to the from the Request object. When sending binary data through a form, and making a request to any Request object other than Request.Querystring, you cannot access the binary data.
The Upload API you have provides you with a method to get the binary data. Use that to retrieve all your form values instead of the Request object.
Instantiate your API first, then do your form value retrievals.
I see that you are making requests to the from the Request object. When sending binary data through a form, and making a request to any Request object other than Request.Querystring, you cannot access the binary data.
The Upload API you have provides you with a method to get the binary data. Use that to retrieve all your form values instead of the Request object.
Instantiate your API first, then do your form value retrievals.
I'm not sure that's the problem, he says he is trying to save the file name in the db and that is accessible from the request object...
Sorry for the delay in my response.
I added the code and nothing is written
you added my code to addnewsresult.asp? This is just supposed to write the data to the screen, not to the db...
Yes, I added it the result page and actually just removed all the other code to see if it was being passed.
Nothing was displayed.
I actually customized the code I found at this site. And got it working. http://www.codeproject.com/asp/aspupl.asp
I would've rather gotten my own working though.
Yes, I added it the result page and actually just removed all the other code to see if it was being passed.
Nothing was displayed.
I actually customized the code I found at this site. And got it working. http://www.codeproject.com/asp/aspupl.asp
I would've rather gotten my own working though.
Glad you got it working regardless, That is what those sites are for, after all.
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Stephane |
last post by:
Hello,
I need to allow an end user to upload video files on a server and in the
same time to put the file name and a few infos in a database. It must be
very simple for the end user, and...
|
by: Thomas Brooks |
last post by:
Hi there....
I have an ASP routine that I'm writing which updates an Access database with
a user name, the file name, etc. all done through parameter processing and
SQL functions.
I do not...
|
by: NohaKhalifa |
last post by:
Dear All;
I'm developing a web site and i need to make adminisration for this
site it's a site for Real Estates .
But I don't need the administration to be online .. I want them to
fill data...
|
by: Codeman II |
last post by:
Hi there,
I am building a form where the user must upload a picture and fill in his
details.
Now I have a problem as all of this is on the same form.
How will I be able to have the Browse...
|
by: Wayne Smith |
last post by:
I've come up against a major headache that I can't seem to find a solution
for but I'm sure there must be a workaround and I would really be grateful
of any help.
I'm currently building a web...
|
by: kev |
last post by:
Hi folks,
I have created a database to store information on equipments. During
the first level of registration, there is a form that i need the user
to fill up details on the equipment testing....
|
by: Stephan |
last post by:
Hi all,
I am new to access and I face the following "issue":
I would like to create a database, to which users can upload files
(=pdf, doc, xls...). The files shall be stored locally on a...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Uploading files from a local computer to a remote web server has many useful purposes, the most...
|
by: MoroccoIT |
last post by:
Greetings -
I saw somewhat similar code (pls see link below) that does mupltiple files upload. It works fine, but I wanted to populate the database with the same files that are uploaded to...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |