Force a download (instead of open)

They have: 32 posts

Joined: Nov 2003

Hi everyone...

Can anybody tell me how I would go about forcing a download of a file. It is a video file and I expect huge amounts of people to view it...however..alot of people would just open the file and play it instead of downloading it to their computer. As they repeatedly come back and "open" the video it will use up alot of bandwidth. I know there are scripts out there that will force a download but am not having any luck finding one.

Thanks..

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I think I answer this question weekly -- if you want to "force" a download, you can zip the file. This will also help your bandwidth.

They have: 32 posts

Joined: Nov 2003

Okay I seriously should have thought of that before posting here...I know more then that . Thanks Suzanne!!

DaveyBoy's picture

They have: 453 posts

Joined: Feb 2003

if you dont wanna do that, for example a lot of typical PC users won't know what to do with a zip file, you can use PHP download scripts, which force a download instead of opening the file.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

typical pc users don't know what to do with a zip file?! don't tell me that Windows doesn't have an auto unzip utility...

Roo's picture

She has: 840 posts

Joined: Apr 1999

New versions of Windows might have a unzipper, don't know for sure, but Windows 98 doesn't. And yes I know lots of people who use their PC's only for e-mail, IM'ing, and browsing, and have no clue about zip files.

Roo

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Good grief! So XP does, though?

Man.

One should include instructions for unzipping if one chooses that route, then.

I had no idea. I'm slightly aghast at the idea of it, since so many applications are zipped, and fonts and other things that are regularly snagged by the average user...

Not knowing what to do with a zip file! :eek:

Roo's picture

She has: 840 posts

Joined: Apr 1999

LOL.....I know people who have had a computers for years, and don't know even the most basic system maintainance! Friends of mine recently went from an aging Mac to a Dell P4, the oldest son has them convinced that defragging will destroy the PC!!! Says his freind lost his hard drive from defragging. (The kid probablly was using P to P, and or downloading pirated stuff.

Roo

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

gak!

druagord's picture

He has: 335 posts

Joined: May 2003

to force a download without actualy modifying the file you can simply force a mime type like this

<link href="toto.txt" type="application/octet-stream">
'

IF , ELSE , WHILE isn't that what life is all about

They have: 32 posts

Joined: Nov 2003

Hey drugord...so are you saying it would be something like this?

And is its compatibilty good?

druagord's picture

He has: 335 posts

Joined: May 2003

yes this is good on any platform since the browser now see the file as application it won't try to open it

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You'd have to do that for each file specifically, though, right?

They have: 32 posts

Joined: Nov 2003

Thank you very much...that's exactly what I was looking for!

Do you have any sites that I can refer to for more "tricks" like this? I would definitely like to learn more!

Thanks again...

Mark

druagord's picture

He has: 335 posts

Joined: May 2003

Maquar well searching in the archive here is a good start. google will give good results too.

Suzanne yes it as to be done on every link and this won't make the file smaller like youre method, but it easier for computer newbes. since windows XP zip uncompression is supported by the os it makes it easier for people to view the files in the zip archive but since it simply open the file like any folder user don't realize it is still compressed and i have seen people complain about it being slow special for audio or video files.

IF , ELSE , WHILE isn't that what life is all about

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.