Wrox Programmer Forums
|
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
 
Old March 29th, 2005, 07:01 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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


 
Old March 29th, 2005, 07:08 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Not exactly clear what you want, perhaps:

<INPUT TYPE="File" ...>

Wind is your friend
Matt
 
Old March 30th, 2005, 10:19 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old March 30th, 2005, 12:27 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old March 30th, 2005, 07:36 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;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
 
Old March 31st, 2005, 03:25 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old March 31st, 2005, 07:31 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;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





Similar Threads
Thread Thread Starter Forum Replies Last Post
open new browser window rocksbhavesh ASP.NET 1.0 and 1.1 Basics 2 July 19th, 2007 07:34 AM
Open new browser window amatytfc ASP.NET 2.0 Basics 2 February 22nd, 2007 06:03 AM
open popup window in asp.net rajn ASP.NET 1.0 and 1.1 Basics 6 August 2nd, 2006 06:23 AM
how to detect in asp.net browser window close connect2sandep ASP.NET 1.0 and 1.1 Professional 1 October 31st, 2005 05:01 AM
Window.Open not passing argument in ASP.NET whiterainbow Javascript How-To 2 May 10th, 2005 04:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.