 |
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

March 29th, 2005, 07:01 PM
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How to open window browser in ASP?
Hi, all,
I want to create a button called "Browser", when user click it, the window browser appears, so user can open the file he want. But how to make the window browser appear in ASP?
Thanks!
Andraw
|

March 29th, 2005, 07:08 PM
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Not exactly clear what you want, perhaps:
<INPUT TYPE="File" ...>
Wind is your friend
Matt
|

March 30th, 2005, 10:19 AM
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes, Matt, that is what I want. It's so easy, but I spent many time to search it, still didn't get the answer.
Thank you very much!
Andraw
|

March 30th, 2005, 12:27 PM
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi, Matt,
I tried it, but still comfused. What's it really do to use input file?
when I use <input type= file ..>, when I click "Browser" button and choose a file, the path is displayed in the text box next to the browser, it just give you the name, not really open the file the user chose, right?
I try the following example:
in initial asp page:
<FORM NAME="oForm"
ACTION="repost.asp"
ENCTYPE="multipart/form-data"
METHOD="post">
<INPUT TYPE="file" NAME="TargetURL"/>
<INPUT TYPE="button" NAME="displayFileName" value="File Name" onClick="javascript:display();"/>
<INPUT TYPE="submit" VALUE="Upload File">
</FORM>
<script language=javascript>
function display(){
document.write ("fileName=" + document.oForm.TargetURL.value);
}
</script>
The following is repost.asp page:
<%@ LANGUAGE = JScript %>
<%
Response.buffer=true;
%>
<HTML>
<TITLE>Repost Example</TITLE>
<BODY>
<H1>Upload Status</H1>
<P>
ALL string : <%=Request.querystring("TargetURL")%><br>
Destination: <B><%=Request.Form("TargetURL") %></B>
</P>
</BODY>
</HTML>
The problem is that when I use "method=post" for the <form>, I can't get the path in repost.asp page by using request.form("TargetURL"), but if I use "method=get", I can get the file path in repost.asp by using Request.querystring("TargetURL"), why?
From the doucment, when use <input type=file..>, we must use the following:
<FORM NAME="oForm"
ACTION="repost.asp"
ENCTYPE="multipart/form-data"
METHOD="post">
but why when use it, the path cann't be accessible?
Andraw
|

March 30th, 2005, 07:36 PM
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
;;;What's it really do to use input file?
Lets the user choose a file from his local machine. Used to upload the file. Reading your post again, this is perhaps not what you want.
I am little confused, where is this file you would like to be opened - client or server?
;;; I can't get the path in repost.asp page by using request.form("TargetURL"), but if I use "method=get", I can get the file path in repost.asp by using Request.querystring("TargetURL"), why?
mmmm, interesting you should be able to get it using a post
Wind is your friend
Matt
|

March 31st, 2005, 03:25 PM
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks, Matt.
The files should be in the client sides. Is my understanding right that use <input type=file..> is just to let the client choose the file, and the path for the file is automatically inserted in the text box, not really open that file? am I right?
I am also confused why when I use post, I cann't get the file name.
Andraw
|

March 31st, 2005, 07:31 PM
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
;;;The files should be in the client sides
You are wanting to ask them what file on thier own machine they want to open? Im sure they know how to open a local file - im a little confused.
;;I am also confused why when I use post, I cann't get the file name.
To post the value from an <input TYPE="file"...> field to another page is no different from any other type of form element
Wind is your friend
Matt
|
|
 |