473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Autodownload File

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
Nov 19 '05 #1
7 3368
Mustafa Rabie wrote:
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/
Nov 19 '05 #2
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>
"Mustafa Rabie" <mr*******@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
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

Nov 19 '05 #3
You can do like this in dotnet.

Response.ContentType = ContentType;
Response.AddHeader("Content-Disposition",
"attachment;filename="+Path.GetFileName(Filename)) ;
Response.WriteFile(Filename);
Response.End();
"Mustafa Rabie" wrote:
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

Nov 19 '05 #4
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/
Nov 19 '05 #5
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
"Mustafa Rabie" <mr*******@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
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

Nov 19 '05 #6
i tried that but there's no after page load function in aspx, so i can fire
that code after the page is loaded.

"Peng Jie" <Pe*****@discussions.microsoft.com> wrote in message
news:25**********************************@microsof t.com...
You can do like this in dotnet.

Response.ContentType = ContentType;
Response.AddHeader("Content-Disposition",
"attachment;filename="+Path.GetFileName(Filename)) ;
Response.WriteFile(Filename);
Response.End();
"Mustafa Rabie" wrote:
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

Nov 19 '05 #7
actually this is much easier... thanks peter i think i'll use the meta
refresh :)
"Peter Morris [Droopy eyes software]" <pe**@not.this.or.this.droopyeyes.com>
wrote in message news:uf**************@TK2MSFTNGP11.phx.gbl...
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/

Nov 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
0
by: TD | last post by:
Hi, I have a problem with the autodownload function for the Java JRE download. Problem is that users with java version 1.4.2 installed do not update to version 1.5.0. I created my autodownload...
7
by: Joseph | last post by:
Hi, I'm having bit of questions on recursive pointer. I have following code that supports upto 8K files but when i do a file like 12K i get a segment fault. I Know it is in this line of code. ...
3
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
2
by: Prakash | last post by:
Hello all, In Intranet, i want to make file download without User Interaction(Dont want the Dialog which ask Open and save) and want to save that file to a specified location in clients system. ...
2
by: kackson | last post by:
Hi, Please direct me if this is the wrong group to ask. I'm writing a c# program to visit website and autodownload files that may be prompted. For example, I visit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.