Help.. how to browse to file and create hyperlink in database

J

Jon D

I have a form where a user enters their name, date etc.
i also want them to be able to click on a browse button and select a
file which will then appear in a textbox. when they press submit i
want the file name and path to be put into the database. e.g.
"C:\windows\work\work.doc". Basically I don't want to UPLOAD the file
just enable the user to browse to it and send the filename and path to
the database.

Any help would be appreciated,

thanks
 
S

Steven Burn

<%
'// eg.asp
strFile = Request.Form("TheFile")
Select Case strFile
Case ""
%>
Show your form here
<%
Case Else
'// Add your processing code here to add strFile to the
database.
End Select
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
B

Bullschmidt

<<
I have a form where a user enters their name, date etc.
i also want them to be able to click on a browse button and select a
file which will then appear in a textbox. when they press submit i want
the file name and path to be put into the database. e.g.
"C:\windows\work\work.doc". Basically I don't want to UPLOAD the file
just enable the user to browse to it and send the filename and path to
the database.
Here is a test file that works for me:

<html>
<body>

<%
' If there was a post.
If Request.Form.Count > 0 Then
Response.Write "LName = " & Request.Form("LName") & "<br>"
Response.Write "FileLocationOnClientPC = " &
Request.Form("FileLocationOnClientPC") & "<br>"
Else
%>
<form id="frmMain" name="frmMain" action="<%=
Request.ServerVariables("SCRIPT_NAME") %>" method="post">
LName: <input type="text" name="LName"><br>
FileLocationOnClientPC: <input type="file"
name="FileLocationOnClientPC"><br>
<input type="submit" name="btnSubmit" value="Submit"><br>
<%
End If
%>

</form>
</body>
</html>

Best regards,
J. Paul Schmidt, Freelance ASP Web Designer
http://www.Bullschmidt.com
ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
J

Jon D

Thanks ever so much for your help but I have a problem with the
example you gave me and can't work out which parts wrong!
" method="post">

This part is displayed on the webpage rather then being part of the
form header. I've tried changing all different parts of the script but
to no avail. Im sure its something simple but I can't see it.

thanks
 
B

Bullschmidt

This should all be one line of code:

<form id="frmMain" name="frmMain" action="<%=
Request.ServerVariables("SCRIPT_NAME") %>" method="post">

Best regards,
J. Paul Schmidt, Freelance ASP Web Designer
http://www.Bullschmidt.com
ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
E

Evertjan.

Bullschmidt wrote on 01 jul 2004 in
microsoft.public.inetserver.asp.general:
This should all be one line of code:

<form id="frmMain" name="frmMain" action="<%=
Request.ServerVariables("SCRIPT_NAME") %>" method="post">

This will also do:

<form id="frmMain"
name="frmMain"
action="<%=Request.ServerVariables("SCRIPT_NAME")%>"
method="post">

And even this will do the same:

<form id="frmMain"
name="frmMain"
method="post">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,525
Members
44,997
Latest member
mileyka

Latest Threads

Top