p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

aspdotnet_website_programming thread: Uploading Files, Client To Server, When Path is Already Known


Message #1 by "Kirk Gomez" <hed2hed@c...> on Mon, 20 May 2002 05:21:56
Hi all.

I am using the <input type=file> HTMLInputFile Control to upload files 
from the client to the server.  When a duplicate file name is found I 
redirect to a separate page and prompt the user for confirmation to 
overwrite the existing file.  

The problem is that all I have now in the new page is the string 
(HTTPPostedFile.Filename passed as a querystring) of the "to be" uploaded 
file.  I can't access the HTTPPostedFile directly since it's on the 
previous page.  

I have already considered making an invisible implementation of the 
HTMLInputFile on the new page.  BUT, the HTMLInputFile (that I know of) 
does not have any properties or methods that all me to drop the string 
value in to use as the path to upload this file.

How do I upload files from client side to server when I know the path 
string and I don't want the user to retype or browse it into an 
HTMLInputFile control.

Thanks.

Kirk Gomez
hed2hed@c...

Message #2 by "Mike Gale" <info@d...> on Mon, 20 May 2002 21:02:03 +1200
If I'm reading you right:

You want to send a page back to the user with the file path (on user's
machine) already filled in.

You can't.  (If you can a program manager somewhere will probably get
fired, if he's lucky)  This is by design to prevent sneak attacks that
grab files from the user's machine.

An alternate might be to upload to a secondary directory if you find
this and ask the user if she wants to overwrite the original file (after
upload).

Mike Gale, Decision Engineering (NZ) Ltd.

-----Original Message-----
From: Kirk Gomez [mailto:hed2hed@c...] 
Sent: Monday, 20 May 2002 05:22
To: Website Programming with ASP.NET
Subject: [aspdotnet_website_programming] Uploading Files, Client To
Server, When Path is Already Known


Hi all.

I am using the <input type=file> HTMLInputFile Control to upload files 
from the client to the server.  When a duplicate file name is found I 
redirect to a separate page and prompt the user for confirmation to 
overwrite the existing file.  

The problem is that all I have now in the new page is the string 
(HTTPPostedFile.Filename passed as a querystring) of the "to be"
uploaded 
file.  I can't access the HTTPPostedFile directly since it's on the 
previous page.  

I have already considered making an invisible implementation of the 
HTMLInputFile on the new page.  BUT, the HTMLInputFile (that I know of) 
does not have any properties or methods that all me to drop the string 
value in to use as the path to upload this file.

How do I upload files from client side to server when I know the path 
string and I don't want the user to retype or browse it into an 
HTMLInputFile control.

Thanks.

Kirk Gomez
hed2hed@c...


  Return to Index