471,831 Members | 817 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,831 software developers and data experts.

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

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
Jul 19 '05 #1
5 1847
<%
'// 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!
"Jon D" <go********************@spamgourmet.com> wrote in message
news:a7**************************@posting.google.c om...
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

Jul 19 '05 #2
<<
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!
Jul 19 '05 #3
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
Bullschmidt <pa**@bullschmidt.com-nospam> wrote in message news:<#0**************@TK2MSFTNGP09.phx.gbl>... <<
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!

Jul 19 '05 #4
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!
Jul 19 '05 #5
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">

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Maria João | last post: by
reply views Thread by Matthew | last post: by
2 posts views Thread by Dulwich | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.