Topic: Make it download (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=9717" title="Pages that link to Topic: Make it download (Page 1 of 1)" rel="nofollow" >Topic: Make it download <span class="small">(Page 1 of 1)</span>\

 
SPyX
Bipolar (III) Inmate

From: College Station, TX
Insane since: Aug 2002

IP logged posted posted 01-25-2004 03:37 Edit Quote

I have an application for membership up on the website I run. It is a .doc. I would like the "What would you like to do" window to pop up when the link is clicked on. Instead, the browser tries to display the file itself and it ends up being unreadable. Is there a way to force the download option?
www.bonfirecoalition.com is the site and http://stuact.tamu.edu/stuorgs/bcs/downloads/Application for BCSnew.doc is the file I want to be downloaded.

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

IP logged posted posted 01-25-2004 09:36 Edit Quote

I believe this is something that can be done on the server side only.

If you have PHP available, try this script:

code:
<?
$filename = $_GET['file'];

// To prevent caching
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

// To tell the browser to download
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/save");

// To get a Save prompt and suggested filename
header("Content-Disposition: attachment; filename=".basename($filename).";");

// To send in binary
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize("$filename"));

// Read the file already
readfile("$filename");
exit();
?>



Would probably be easiest to save it as "download.php" in the directory the .doc file is in and link to the file with "download.php?file=blub.doc".

Instead of the "octet-stream" header you might also try one specifically for Word documents, though I'm pretty sure it'll work as it is as well.

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

IP logged posted posted 01-25-2004 16:13 Edit Quote

Yep - its largely covered in the PHP manual:
http://www.php.net/header

but I think the best way would be to zip it up which does everyone a favour

___________________
Emps

The Emperor dot org

HZR
Bipolar (III) Inmate

From: Cold Sweden
Insane since: Jul 2002

IP logged posted posted 01-25-2004 17:38 Edit Quote

You shouldn't force people to download something they may have configured to open in their browser IMO.

SPyX
Bipolar (III) Inmate

From: College Station, TX
Insane since: Aug 2002

IP logged posted posted 01-25-2004 21:17 Edit Quote

HZR: That's a fine theory. Except what gets displayed is this:

quote:
ÐÏࡱá>þÿ -/þÿÿÿ,ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿì¥ÁM ð¿ûbjbjâ=â= ,€W€Wõ ÿÿÿÿÿÿl<<<<<<<PŒŒŒ8Ä Ð$Pª„ )++++++$. N’O< O( << d( ( ( :< < ³v( )( ( <‹<<³ ô `2ž³àÃP<Œ: ²£³z0ª«àì <à³( PP<<<<ÙBonfire Coalition for Students General Member Application Instructions Complete the Personal Information, Parts I and II of the application. There will be a Mandatory retreat for ALL members from 5:00 pm Friday February 6th to no later than 2:00 pm on Saturday February 7th. We will meet and leave from the yellow lot next to Simpson Drill Field on Friday at 5. Member Dues will be $35, which covers the cost of a Polo and the general member retreat. Applications are due Friday January 30, 2004 at 5:00 P.M. in the BCS cubicle in the Student Activities area of Koldus Building. Personal Information Name: __________________________________________________________________ Last First Middle Preferred/Nickname Birthday: _____/_____/_________ SS#: _________________________ Local Address: ___________________________________________________________ Street City State Zip Permanent Address: _______________________________________________________ Street City State Zip Local Phone: ______________________ Cell Phone: __________________ Class Year: _________________ Email Address:_______________________________ Major: _____________________ Expected Graduation Date: _____________________ AOL IM Name:________________________ Shirt Size: ____________ Favorite Aggie Memory:____________________________________________________ Previous Involvement:_____________________________________________________ Hobbies:________________________________________________________________ Part I Aggie Knowledge Quiz Complete the following questions regarding Texas A&M University. Use any source that you feel is necessary to complete these ten questions. Feel free to search the internet, buildings and statues on campus, and if all else fails ask another student. Please do not email anyone in BCS for answers or clues. 1. Lawrence Sullivan Ross was a “_________________, _________________, and _______________ _________________.” 2. What do the five stars on the shield of the Aggie Ring represent? I. II. III. IV. V. 3. What years (other than 1999) did Bonfire fall? 4. What three places on campus was Bonfire held? 5. What was the title for those in charge of their dorm at cut? 6. Who lead the Muster during the Japanese siege of the Philippine island of Corregidor, gaining an international recognition of Aggie Muster? 7. How did “a group of young Aggies representing the class of ’94 decide to honor the class of ’64?” (hint: look in the MSC) 8. What is the difference between our clock tower and t.u.’s clock tower? (other than murder) 9. List the names and class years of the seven Aggie Medal of Honor recipients. 10. What do the trees surrounding Simpson Drill Field memorialize? Part 2 Use one page to be creative and convince us that BCS will benefit from your membership. Feel free to do anything you like, pictures, poems, collages, essays, etc. The limit is your own imagination. : ©àãnÉIJ_`ªÕlŒØ= E Z e j ‘ + , #&-1:õö÷øúûõðèÜèÓèÓèðʼ±ðððð©¼èžèðð©èžè››èKH56CJ\]aJ5CJ\aJCJOJQJ^JaJ >*CJaJ5CJ0\aJ05>*CJ\aJ6CJH*]aJ56>*CJ\]aJ6CJ]aJCJaJ56CJ8\]aJ8':;HInÉIJ_`©ÕÖ !lŒØab°±úúúúúííííúúúëëëëëëëëëëëëëëë & F„h„˜þ^„h`„˜þ$a$õúþþ±  [ \ § ¨ ó ô = > E Z ‘ ’   I N T [ a g h › œ  Ï Ð ýýýýýýýýýýøøýýýýýýýýýýýýýýýý$a$Ð Ñ    ¤ ¥ ¦ %&'‡‰ŠÛÜÝÞßà#$%&-õö÷ýýýýýýýýýýýýýýýýýýýýøøýöøïý ÆàÀ!$a$÷øùúûøööñ$a$ ÆàÀ!*00P°Ð/ °à=!°"°# $ %°°` iD@ñÿD Normal1$5$7$8$H$KH_HmH sH tH @`@ Heading 1$$@&a$5CJ\aJEZ‘’INT[agh›œÏÐÑ   ¤ ¥ ¦ % & ' ‡ ‰ Š Û Ü Ý Þ ß à # $ % & - õ ö ÷ ø ü š0€€š0€€š0€€š0€€š0€€š 0€€š 0€€š 0€€š 0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€ š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š0€€š@0€€š@0€€š@0€€ 0û ±Ð ÷û ú 8>b l ^ d õ ù ü r ¦ô~‡ÌØ qs¼¾ûý  ^ b t y õ ù ü 3333333333333¹ºÖàãûmÈÈÝHÂÂËÔõZ=ruxyqqvˆÕ  ‡ ’ £ ª $ q † Ú Ú Þ " # # % & ô ü ÿÿ Nick LevittDC:\Documents and Settings\default\Desktop\Application for BCSnew.doc Nick LevittDC:\Documents and Settings\default\Desktop\Application for BCSnew.doc Nick LevittDC:\Documents and Settings\default\Desktop\Application for BCSnew.doc Nick LevittDC:\Documents and Settings\default\Desktop\Application for BCSnew.doc Nick LevittDC:\Documents and Settings\default\Desktop\Application for BCSnew.doc Nick LevittDC:\Documents and Settings\default\Desktop\Application for BCSnew.doc Nick LevittDC:\Documents and Settings\default\Desktop\Application for BCSnew.doc Nick LevittDC:\Documents and Settings\default\Desktop\Application for BCSnew.d . . .



Dig?

I don't really know PHP. I appreciate you doing that work for me but I don't even know if that option is available to me. I'll guess I'll zip it up. I wanted to avoid that since it is only a 20kb file anyway.

Thanks guys.



It's pronounced "Spikes!"

HZR
Bipolar (III) Inmate

From: Cold Sweden
Insane since: Jul 2002

IP logged posted posted 01-25-2004 21:31 Edit Quote

Something must be wrong then. Could it be something with your compuuter or does it happen everywhere (The URL you posted says "Error! The file you requested was not found.", so I can't see it)?

SPyX
Bipolar (III) Inmate

From: College Station, TX
Insane since: Aug 2002

IP logged posted posted 01-26-2004 00:38 Edit Quote

Oh I see. UBB breaks it up.

norm
Paranoid (IV) Inmate

From: [s]underwater[/s] under-snow in Juneau
Insane since: Sep 2002

IP logged posted posted 02-06-2004 22:10 Edit Quote

the solution to your problem is to tweak the mime settings serverside with a .htaccess file-

upload an .htaccess file to the webdirectory containing the line

AddType application/msword doc

Then change the file permissions so that it is executable

/* Sure, go ahead and code in your fancy IDE. Just remember: it's all fun and games until someone puts an $i out */



Post Reply
 
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
 
Your Text:
Loading...
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu