Autodownload File

M

Mustafa Rabie

Hi All,

I want to add autodownload like all the one in Downloads.com. When u click
download now link it redirects you to a page that the file downloads the
application after the page is loaded.
how can i do that?

thanks
mustafa
 
?

=?ISO-8859-1?Q?Anders_Nor=E5s?=

Mustafa said:
I want to add autodownload like all the one in Downloads.com. When u click
download now link it redirects you to a page that the file downloads the
application after the page is loaded.
how can i do that?
You need to do this:
1) The "download" link points to page X.
2) Page X redirects to the zip, exe or other file the user should download.

You can pass the name of the file to download as a query string
parameter to create a dynamic "page X".

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
 
W

William F. Robertson, Jr.

If you view source on their page you will see how they accomplish this.
They are writing an iframe into the document with a src of the file to
download.

This code needs to be somewhere on your page.

for the window.onLoad event the beginDownload method will be called. It
writes out an iframe with the src attribute to download.

The <noscript> tag is processed on browsers that do not support scripts.

hth,

bill

<script language="JavaScript" type="text/javascript">
<!--
function beginDownload() {
idl = -1;
idl = location.search.indexOf("idl=n");
if (idl < 0) document.write('<iframe height="0" width="0"
src="http://myserver.com/downloads/file.exe"></iframe>');
}
window.onLoad=beginDownload();
//-->
</script>
<noscript>
<iframe height="0" width="0"
src="http://myserver.com/downloads/file.exe"> </iframe>
</noscript>
 
G

Guest

You can do like this in dotnet.

Response.ContentType = ContentType;
Response.AddHeader("Content-Disposition",
"attachment;filename="+Path.GetFileName(Filename));
Response.WriteFile(Filename);
Response.End();
 
P

Peter Morris [Droopy eyes software]

All I think you need is a META REFRESH in the download page. If the target
page is a ZIP etc (can't be displayed visually in the browser) the browser
will open a download dialog instead of navigating.

I do this on my own site in ASP -
http://www.droopyeyes.com/downloads/ecomodeler.asp



--
Pete
====
ECO Modeler, Audio compression components, DIB graphics controls,
FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/
 
M

Mustafa Rabie

thank you for your replies they are very helpful, but the redirect to page x
with the link wont work since it wont display the page.
I want it to be when after the page is loaded and displayed it starts
downloading.

I think the iFrame idea is good, i can hide the iframe and redirect to the
file from inside it.

any feedback and comments is more than welcome of course! ;)

thanks for your help really appreciated
mustafa
 
M

Mustafa Rabie

i tried that but there's no after page load function in aspx, so i can fire
that code after the page is loaded.
 
M

Mustafa Rabie

actually this is much easier... thanks peter i think i'll use the meta
refresh :)
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top