"Save As" dialog???

G

Guest

Hi

I'm new to ASP/Web programming so any help would be appreciated...

Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. When the user clicks to start the download I would like to display the "Save As" dialog, allow the user to name a place to save the file, and then show the download progress bar while the file downloads

Question:

How do I make a windows "Save As" dialog appear when the user clicks on a link {or button} to download a large file? I've been looking at source for several web pages that do this and I think they use J-Script - does this make sense? How do I share data between the web page and the "Save As" dialog so that I can seed the dialog with a default filename and location

As I said I'm new to ASP.NET programming so I don't know where to start; any direction would be useful..

--Richar
 
A

Alek Davis

Richard,

Why would you want to go through all this trouble to reinvent the wheel?
There is already functionality you are looking for, which is built in all
Web browsers. Or are you simply asking how to allow users download a file
using the standard browser-implemented functionality? In the latter case, if
the file to be downloaded has a standard extension (e.g. zip), any link to
this file (either static or programmatic) will cause the "Save As" dialog to
pop up. If you want to display the "Save As" dialog and allow the users to
download files, which would normally be displayed in the browser window
(e.g. XML), or if you want to generate the contents of the file on the fly,
it can be done as well with a couple of lines of code.

Alek

Richard said:
Hi,

I'm new to ASP/Web programming so any help would be appreciated...

Situation: On my web page I would like to present a link {or button} that
would allow the user to download a large file. When the user clicks to
start the download I would like to display the "Save As" dialog, allow the
user to name a place to save the file, and then show the download progress
bar while the file downloads.
Question:

How do I make a windows "Save As" dialog appear when the user clicks on a
link {or button} to download a large file? I've been looking at source for
several web pages that do this and I think they use J-Script - does this
make sense? How do I share data between the web page and the "Save As"
dialog so that I can seed the dialog with a default filename and location?
As I said I'm new to ASP.NET programming so I don't know where to start;
any direction would be useful...
 
G

Guest

Hi
Why would you want to go through all this trouble to reinvent the wheel
There is already functionality you are looking for, which is built in al
Web browsers.


Not trying to reinvent the wheel --> I know that browsers can do it I just dunno how to make a browser do it or what the "theory of operation" is. From the source that I've looked at it appears that I need JScript - Is this correct
If you want to display the "Save As" dialog and allow the users t
download files, which would normally be displayed in the browser windo
(e.g. XML), or if you want to generate the contents of the file on the fly
it can be done as well with a couple of lines of code


Ahhh yes and what might that code look like? Is it J-Script? VB-Script? Am I displaying a Windows common dialog box, some kind of control provided by the browser? Or something that JScript provides? I dunno where to start here..

--Richar


Richard said:
would allow the user to download a large file. When the user clicks t
start the download I would like to display the "Save As" dialog, allow th
user to name a place to save the file, and then show the download progres
bar while the file downloadslink {or button} to download a large file? I've been looking at source fo
several web pages that do this and I think they use J-Script - does thi
make sense? How do I share data between the web page and the "Save As
dialog so that I can seed the dialog with a default filename and location
 
A

Alek Davis

No, no, I think it is more simple than you think. You do not need to build
any controls or dialogs, because they are all built into the browser. It is
unlikely that you need to implement any JavaScript, at least in the sense
you may have (like making JavaScript display the prompts or whatever). Now,
depending on how exactly you want to do it depends on what you want to do.
In the most trivial case, you do not even need to do anything. For example,
if you display a link to file by clicking which the user should be prompted
to save it, assuming that the file has a proper MIME type (i.e. MIME type
indicating to the browser that the proper action would be a download, such
as EXE, ZIP, MSI, CHM, etc), then you do not need any coding. The user will
get the "Save As" prompt automatically. Now, let's say that you want to use
a button instead of the link. In this case, there may be different options
which may require either client-side or code-behind programming, but the
goal of either option would be to point the user (browser) to the URL of
your file. As I said before, if your file has a MIME type, which does not
cause the "Save As" dialog to pop up, you may need to add some code (not a
lot) to override the default browser behavior. I do not have any samples at
hand now, but if this is what you are looking for, please reply to this
post, and I will try to find something (probably tomorrow, as I am about to
leave). Or maybe someone else can do it before me.

Alek

Richard said:
Hi,


Not trying to reinvent the wheel --> I know that browsers can do it I just
dunno how to make a browser do it or what the "theory of operation" is.
From the source that I've looked at it appears that I need JScript - Is this
correct?
Ahhh yes and what might that code look like? Is it J-Script? VB-Script?
Am I displaying a Windows common dialog box, some kind of control provided
by the browser? Or something that JScript provides? I dunno where to start
here...
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top