Jump to content

[SOLVED] forcing a download


adam291086

Recommended Posts

I am using the script by eLouai's Download Script. When i go to download i get

 

¢“¸žÕYæØ #’p+6úifxцÈÏ;O_©ÿ ͹U’L«*i´uº=ä1²Må+°ŠŒÃ/ê9î+ymàT’yUU˜u±IÏÌÿ¦kÏ-g}>už-€ãHʸô#¸®¢éÓV‚=bÉ<ÉsnìÙmP:‘Ûœœç ._Cù½MØn Ûɱèì ·'põÆaYúši¤––² œ®§Ë”Ž¯ýqžø'Ò¢3©²Yà¸w´W2òQ‰#`î ôÈ«Ocö{9ndͺ0Üë,»ãVï†<cšÊ¥ó%tÿ­¼Žºs„èÙ»IW¿ŸàyÜiדAv›&‚§×Ôzýi ºD91ƒžùàWK¯¨ñ ÆÁ‘ž1sœ—öÇaßúsÆ2Im3Bëó©ÁW9Z7Ñâ™0꧎ëRZXÛH̬XåpJ£e¼°VÈ銰<ÈÜ:‚Š¶®ˆNÌ݆ ÓlJTNNsCÚù‘¬ƒ£Ò·Jç:Q·J˜ç½BÙÎh ÓïRËœT8>´Äh 0*›wºQ³‰GÝÿ ½¦X+Â××Îc¶AŸvÿëVV§â6.bÓ![tÇpÎAéÇEþtBÔRô#ºéì‘^lVq•Áý*m7^m&èO«)d‹8/¡¬$¶k¹|Éæ ™²íÕFxï†ý*›ùbæQbˆO3†ÇlûÖ¼ý¹m©èÒê–ŵK{’ÑÞa^Øœ‹Éznëצr=ù¯xš÷XÙ’ù6‘"¶CÀ“üGÜÖÊ6úœ~TУ¿_Z.Ò±rjNöÒ¡ÌNè[º’?•Oùò|çq<Ô* :Ôñ¶gš,Ú€cQš±2¡‹qÀÀ¬ä»H—,ÀNõ5š]k—QÛÀŒ³$¸ÈŒŒŸÖµrIjd¢Û/iNd²V=70Lš´Ä~jÿKMåôøÁ1ÄŒ·VSÎ<þUMˆÅr½Î¥°Œ¨$Æ*FËXYZ Zs¬¦&XYZ (W¸3XYZ óRÏsf32BÞÿÿó&’ý‘ÿÿû¢ÿÿý£ÜÀlcurv3mlucenUS$žesES,LdaDK4ÚdeDE,˜fiFI(ÄfrFU<ÂitIT,rnlNL$noNO xptBR(JsvSE*ìjaJPkoKR2zhTW2zhCNÄKameran RGB-profiiliRGB-profil för Kamera0«0á0é RGB 0×0í0Õ0¡0¤0ëexOMvøj_ RGB ‚r_icÏðPerfil RGB para CámaraRGB-kameraprofilRGB-Profil für Kamerasvøg: RGB cÏðe‡NöRGB-beskrivelse til KameraRGB-profiel CameraÎtºT·| RGB Õ¸\ÓÇ|Perfil RGB de CâmeraProfilo RGB FotocameraCamera RGB ProfileProfil RVB de l appareil-phototextCopyright 2003 Apple Computer Inc., all rights reserved.descCamera RGB ProfileCamera RGB ProfileÿÚ?üêWhÛ€{㎤~Ù ‘Î;Ÿóô¯9ûÎÆœÒIÅ•F@ Ùì:ÕcŒÊ¡Ï'®G8ìk:òò!ÇKÔêW’=ÛAÏN£¯ãŠw•·9$¯aŒþ5qwŠ5Œ¯6ΗKÙ‘“‚pÉ®ªX‰ÎIÇãŠI´o$´·rÖ›ò=Â*XŒVúÂà¨v‘ÔMwSÑX᪹gbp‘¡*»³x8 Cosÿ׫iÞæRQj=Ë1*ˆÛ“´{s‘É<ԒƆUÜp~ƒÓ·5¥ìÙkFÙ^tc’2v’~µËX¯—ýîâY×”‚r:zTofkdYH˜è¬UO^zã𫈫´9÷¤ôH›¾…ŠÀ4g'=úTÛp8àƒÓ¥ ÞÉ‚²nÄ¡ Q€þ”è ÑÔž@ÇúqšN*/Ô»sÞýK ™tfíè{ŸÓh‡'´íè'ÓœUt± îOä.sÏáþ—`Ï ã8Í-Õ…Ë©)Mà`a}ûþ*Åû°1ó=+K%kvK’ù`8ÉÉ«1 ŽqŽ¾”EkaÅô%ÔnþœÿŸëV¶{ôÆ¥½"Kšï¹4<¾H9æ Xá‰äàgךká·a%k²eÈb¸Yä–ô§¬hNP¤äzÒnîâ—+µÉð²{~gÿ¯BÆ2òAç‘È¢úXm“F§¨'$ta×ÿÕW#\,yç¯j;!%{_¿ù’F§i`¸çŒŒR¦ì0ÛÔö4ýÛI0,¤QIè~‚¤Œ¥sÇLãZ«(?5ª,„6ü’>‚¬W*ÃïŸçíY÷E(ónHÛr ·8ùrzŒzñRìß”`ñƒÕh“oBeÔ˜!#ÀéR,q£éÛ %¸žŠþc±»q~玦¬¤m¹H9ñëT½æ;jZ*Ê8ÉÉw§Ì^v/^äút§ei&VäѨ%òãÎ{Ò¬EÚËò÷ª¤¬›ïb6ÐœDeø{tüê×’|ÀÊ>`;uäZ]Sþ¶²m.„Š‡k9è8ÈíúSÖ%VÎq×ʈ()r¤N±/θÀüE=S’N?ãGÅ¡)kbU9ÚrsÔõ§z°‚$á1ÓùÑ%uÌ9tþ»Xƒ7ÊÆ2HÁÅ<¨ÉMŸ2œqÔóWÈ„Û‚L™Q9ÂeºãX¾\• vÿõc52~óE ùG,j¤©ÉÏqÍJè2r¸'€OZ§ÊÔZë`vq¿rÊGòqÐzõ穧'¨#׊,¥÷k$ƘÂçoo^ÿJóŠ#8=ÿýu¤-¬|®9>½‹*²…Û8jß—·s íй¥&÷_Ö¤¦’´ À;›.Ü_Æ ,Ø\½\нèßúЉ-&H€|õ\ã§ò ‡J’S¡ÛùÓR¸à¬Ëó|Ý~´ˆ° rO#·ò¥ï_™vKFK"‘2¨\/<ŽüWÏú¼Jo¯“Žd8ÏSIj¤RIÏÐËXvqŽ„÷úWο´|'þNÑ“0¬¤µlká±ðñ¨`FH=»ŸZ‡jpÌÏæk&Ê“\®ÃØ>êØÁÿ8¥ÈÝûÌûŸJÁ²-‘®ó)aÜZü²ý¨I£0è9žj¡ñ!öK¡ýÁ4âWý‘î`™// 2®sÿÖ?ZúGÀ±B,m„kµHÂàt®ˆËV»˜Ih¬zÒÆ< 8^…y5©¤y‹sk“ŒúgÚªOš+È#l»½LBÅåààr)šµ¸]Ðu8òÎ \t»*_fFO€¢Q«ÁÇNù¯£ux¶C”î ƒA\Ò÷¡cU«hóÃûÇuÝŸ úÔð¦c€9è=þµ€ù®È&ˆgËN˜çÚ¨I¥¨(êoÊ™Rz¿2°·]ÑŽ2~÷Ò—ÊS½TäðqùQn¢KDÅ0R£$÷ö¥6C ¨ô¦¾"Þ蘻áÃò«%Ä^bí#ô4 ea.¢,q“j专Á>¼TÁ|·QÜÔ£µŠ†ÉÏÏËžIíÖ¡žÝŽÑŽ0zŽ‡:SkDÉwål³^\#p"\`mÇ¥9T»!À¦›ÚäËK c}äc€2OcŸÂ¥Ú&*yôÓШ¸Å7"âÝ»ÇNõ3 [åQóƒÍOPZ.nä2[²¡“qÃð@ïëX ¾èf€ª¹lŸ½ôãü)ôZ¤~o|rdÅ×*K6§Ò¼JT€pF@=¿J×XÅ2fí>B£ª£`ì3Éüj9ƒ‘É;zŸåYµo븹’»CN`~\€G?Ê«º6\B’sÓŸN´ÛÜ$¾'䛊+`®xã=jEPÄüÇ·~håRV}5-$åf#&$a·žƒ×ÜÓ‚`ïP`ôÅDŸÃqøml`ð=êìqçæΰúVUQ²)h“þ¶,GµAMØSß»j¬JŽWŒ`gÞ£i_Ј7™ì¿Ñÿµí¤UÏÍógŠúb,º¾~ñ;qŽž”êGí.†Ðv¼Hî-Ñ•etžØ5NMÌÅý(_¤ ù»Œ,[Û;³Œƒ×ךÏ* 3"Äž½¿zmÆú™Ïâ°æO1†PnU뎕Ck$¤wg¡äJZ´)n¤,¶ÌŸ0$äóíýjw²ì$vÈ -Ý—k2&u*ñŠd€' “ßéôâ§ìÉ ;hW–6*dQû²@¿ö±[¬›•”ˆÁÈÈÿZÒý%D™‘D¡ˆÈì?*ªb-û£†‰ÏR>‚¥;Z=Ãur¼«)è~\c=þ•„Ä2ä0íëÛ TU¢ÉR´ÑU‡˜»AR1‘Ôþ«äqqŒ{~•+ÝÓÈ"îÊf@Ùo™‰F:Ž•Râ0¯&yÇ~‡ô©›Nvbš!AÜ꧎3Þ¢–?1Y˜cg¯j‘ÖÁ ܨþb°m¸* àz{TrÀ<¶“x'¡¹5ëD8k "'‰_!pBŽÂ«ùy^ƒ$T•¬6Œ½,PØåCpPŒâ¼'㜉…uSó´gŸ@xâˆÉó[ÈÉ%f~ej²cr–!$RsaÍsw«ö€®S ®zŸÇ·å]-ZÖ9ÓIÙõ9àK‚ ©’KëôükÎ5–´°v;OãîÿJ™ ,ZWÔÃd«–$e<Èb£p±¿RN28<>”ºÛúÜJÌþƒÂÇ…dûëÓ"£tpBän=ûW~Þ×6r²²Ñ–ÇûͤqïÐÿ‘Yó(SÈ9Ç9ÅL ¨[K˜þnœŽ}ð¥ÜA_îçóúÔÇv»íiÜè4À]÷‘…ôÇzë]@Ttߎùÿ -ï[¹£n1»'±&™˜†' tÐnl/–Hè}XWu$ÔUÎz—ö¬´ÑFuSÔç§nj©@Î`¼óÜ¥t9)Ýôëÿš(÷ÄÜaXŸÂ¬È…•BsÈéJZÝúv)NŸ¹VÉã9*:ʹKeæ*ðë#gõç CZY 'wèh4NçjzŠ²‘4€®ÌçÜRoš.&±vv&Ž¸´àú J «2òqÉÏÊŽk¦‘ 4ÕÉš%07cßÞ§E¬3Æ8üJi6Ñm>wbXTå”Np0?µ2Äwu$žƒÒ« …¾„Á~eA'œŽÕ.ÖV†N:ßJvål}lN¥™ÏÊ:w×}jÀ‰ÜGÊ'ýšI»+Š>ò°»»äž{~0QYq¸qÁÆkDýë‹kù–£ìÜŒ{ŽíN !ÜÜá±õõíY½tvEÈ¢`Å8àÓLR6ñŒgƒÂš´.Ä»>nÿÈ©$sµŸÓ Päí”\ô#9Ê €„* Á¼þT’èL"¾×a fÊœ{v«fr?Ò…Ð<Ç(áH$¿°àUˆÔ0*ÃOSÏÖ´¹.üÉ"M¨Sïdg*ÊFGÏ€=(InÊZ«–6¸;¶c×>Ÿ…Y6cièZ#{X"ºì!•˜ãƒœz~U*¬€¸ÔqŸ×R÷REj¶µBî(I>ŸáS,x`Ù¿J««_¹bÂÅÑù²AÁ>ø©„*AËçzƒøT~ƒµÑ"¢ôÚN3רÿõÕ¼5j^úBjÍ?"£>ÁÆÜsžõ M›°1Œº=ÅCÖìh-Î$ç?ýj•£98ÎÒ3Èëì*íëþd˹&ÐÙÈÆA«©üJü? Twh¥gvº’…#hà_óøT‘®Ñ¸´~céÅ8ÇiËWbRi2xíÖ¤PX€@p8§;ÙßÌrÆ¿;n=qÿêâ¥L—N¡Hz³¿¼ãÜžmK~Zä…^:g×½4D¯–u ƒÀô­SæL{¾UܶˆwH§_þµH±ô°Ùüõ¥Ë~V9'{ö%1(ý~†Ÿ‚pŒ0OJžU).S9ÝÊȲ±:äÎzÔŽŒ¬¬Œ€8Þª1k›æ]ù”P›âå°Aíò)X´ÐÇ"œ=Ȳ/ï~%¨ñ´dp}?ýX«£éœã >ÇŠ/Ë]|+£ÊI`pêqÒ¥*¹:œžô'ÊšÖèR’6ìgƒÁôСX·—Ï·zihåä);jXXÁä‚W©Ïl~ÆBömÀzæ ¶ÒQ%§kU ž%¿‚qÛ¿Zùÿ\…—T½PCIæ1ÑMMõ·õԸߕ¾Æs*™Ü; ùçöŽQ'ƒâÀóy㟥gSDh¶gçÄ¿$ ;óÑqÛ=*¤üã8õ<×6÷¦£f+ÆSj‚H#=zf•T‚Kœ· ê?QkX:¿ëbó°ñž ×å‡íIˆ¾(aßÈ@n =iÃt 5&@ŸðM=ŸðÈË%¶ðßk¿Ç¦ÕÚ8ã®àÇèE}'à¶i‘¯Ê6€£Ä}qŠÞ:·3Þê窕_Iƒ‘“íõ Í&o£#9¨êݪ¢Ô§~šãyy»dD¥@ϨÅ™4›Ö,yŒóÜg m-ôbNö‰‹ðú-ºµºõ}yï_Fk91ÉŒ„ÙÆÿZ¸¯¿©¬^ œ!_½…ùùõ4Ø€YˆÎ88éÏÒ¥£Eg+6wenÆwýUVbAôõÇáR IY²¡dPAUzWUBNÎzñÔÕyzX–UÚÙÉÁâ£mÊH É⇦ Þ¨‰".OòüúÕ"DZ $'Ž? &îÛ+áбùØí`HÚ;ËÇ`dQÎßOþ¿JNÃNÑDàÈïÌd`öïÅF¥™›÷`Óž´'tÛºH^Tɹ{që×éN0ªœ.7H4ßDg"lá;ÁïÔTÂcOR8Í.€ &ÛWËÊîÈàv§Cš[Ÿ—¯ÐÑÔo^R NU'åüO¥sz°Ûm3‚I*I½èÙåy_±ù¹ñ¥‹øÂç®úuæ¼tªåמ9Ï©>ø ä׳D7y·æf¼[d`:qùR¾Gßç'=úÕœž¶-¥©YÝç‚ çð㩦$Œ’r8â¦Ú\«Ý?ëa§p#æÆ4ã “ôúÜ{»! Š0K‘Ž•-º2(Lç$S%}þ/BDŒazœ`Ozœ/€ð2¤ö¨•¶c½Óù–âáJàûŽ+¨Ó¢LƒåêG¦×ûʲj,ö‡1§öÄCG‚8àß=ë鈘äe# rnµÕܸ+¢¼ÑÊìåÉ’pôªF%yKp1~)/Œ%Ð|ŠñäÈéÍBêÈU$ž£ùçÞ‡nf™M~&Óæ†<Ž@íYÍ$G“9ÏLþ\Ñk{ÄÏâÌ™ƒW±>¿ˆóï²äàs1š¨ÛÞo©¢|ßy›rŠYÕ<õ?þªnÒȸž2¥}Ù•¯6ˆ¥Ú2Tü£Äuª’™iVŽx‡åëV×½`”µÐ óFª

 

print to the screen instead of the file downloaing. Why?

Link to comment
Share on other sites

its all protected by sesions, heres the download script

 

<?php


session_start();

// is the one accessing this page logged in or not?

if (!isset ($_SESSION['logged'])) 

{

// not logged in, move to login page   

echo "<meta http-equiv=\"refresh\" content=\"0;url=http://www.rubberduckiee.co.uk/login/login.php\">";

}



$filename = $_GET['file'];
echo $filename;

$filename = str_replace("/rubberduckiee", "", $filename);

$filename= $_SERVER['DOCUMENT_ROOT'].$filename;

echo $filename;

// required for IE, otherwise Content-disposition is ignored

if(ini_get('zlib.output_compression'))

  ini_set('zlib.output_compression', 'Off');



// addition by Jorg Weske

$file_extension = strtolower(substr(strrchr($filename,"."),1));



if( $filename == "" ) 

{

  echo "<html><title>eLouai's Download Script</title><body>ERROR: download file NOT SPECIFIED. USE force-download.php?file=filepath</body></html>";

  exit;

} elseif ( ! file_exists( $filename ) ) 

{

  echo "<html><title>eLouai's Download Script</title><body>ERROR: File not found. USE force-download.php?file=filepath</body></html>";

  exit;

};

switch( $file_extension )

{

  case "pdf": $ctype="application/pdf"; break;

  case "exe": $ctype="application/octet-stream"; break;

  case "zip": $ctype="application/zip"; break;

  case "doc": $ctype="application/msword"; break;

  case "xls": $ctype="application/vnd.ms-excel"; break;

  case "ppt": $ctype="application/vnd.ms-powerpoint"; break;

  case "gif": $ctype="image/gif"; break;

  case "png": $ctype="image/png"; break;

  case "jpeg":

  case "jpg": $ctype="image/jpg"; break;
  case "JPG": $ctype="image/jpg"; break;

  default: $ctype="application/force-download";

}

header("Pragma: public"); // required

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

header("Cache-Control: private",false); // required for certain browsers 

header("Content-Type: $ctype");

// change, added quotes to allow spaces in filenames, by Rajkumar Singh

header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );

header("Content-Transfer-Encoding: binary");

header("Content-Length: ".filesize($filename));

readfile("$filename");

exit();
?>

 

and the link to the download.php http://www.rubberduckiee.co.uk/admin/FTP/code/download.php?file=/rubberduckiee/www.adamplowman.co.uk/IMG_0428.JPG&currDir=/rubberduckiee/www.adamplowman.co.uk'

Link to comment
Share on other sites

I'm no expert at this sort of thing... but php.net has plenty of these scripts...

 

<?php
$filename = "whatever.xxx";
$myFile = "/absolute/path/to/whatever.xxx";

$mm_type="application/octet-stream";

header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($myFile)) );
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");

readfile($myFile);

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.