Jump to content

Header attachment totally failing?!


Recommended Posts

This morning, I had a working php script. Simply using

header("Content-type:audio/x-wav");header("Content-Disposition:attachment;filename=ASCII.wav");readfile("ASCII.wav");

Now... This morning it was downloading the song properly. But now when I download it, it's only 222 bytes.I haven't changed anything at all... it's really making me mad!I cant figure out why this isnt workingHELP

Link to post
Share on other sites

Still isnt working... I made another page to get the value in bytes; here's the code I have now.header("Content-Disposition:attachment;filename=ASCII.wav;content-length:27770924");It's still download 222 bytes!

Link to post
Share on other sites

Now that I think about it that could be glitchy; here's my full code NOW....header("Content-type:audio/x-wav");header("Content-Disposition:attachment;filename=ASCII.wav");header("Content-Length:27770924");

Link to post
Share on other sites

Technically, you're supposed to have a space after the colon after the header name. e.g.:header('Content-type: application/octet-stream');header('Content-Disposition: attachment; filename="report.csv"');

Link to post
Share on other sites

If your host supports it I would suggestion using zlib.output compression as well as the flush() method

if($_GET['mode'] == 'export' && $_GET['dl'] == '1') {if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off');$044467d6c7609f0c48bbfa6b4e6a1202 = mysql_query("SELECT * FROM files WHERE token = '".$10bbf6d474e63a7580069a78e2690fe9."'");$cf_rows = mysql_fetch_array($044467d6c7609f0c48bbfa6b4e6a1202);$128263007e9a21197bc41887abdaeb97 = $cf_rows['file'];$size = $cf_rows['size'];$name = $cf_rows['name'];$type = $cf_rows['type'];$oath = $cf_rows['aoth_tkn'];if($0b77a7157d890651d8be9867aff97a52 != 09bfa665212399c841c8e844dc29a4e6($0b06d2f4f9f2c06c1dc3255b9ea877d2])) {  exit();} else {header("Pragma: public"); // requiredheader("Expires: 0");header("Cache-Control: must-revalidate, post-check=0, pre-check=0");header("Cache-Control: private",false); // required for certain browsersheader("Content-Type: ".$type."");header("Content-Transfer-Encoding: binary"); header("Content-Disposition:attachment;filename=".$name."");header("Content-Length: ".$size);ob_clean(); flush();$fp = fopen($128263007e9a21197bc41887abdaeb97, "r"); while (!feof($fp)){	echo fread($fp, 65536); 	flush(); // this is essential for large downloads}  fclose($fp);#readfile("".$128263007e9a21197bc41887abdaeb97."");}}}

The attachment location will not be shown and not only that but my attachments are hashed via md5 and then uploaded to web server however during downloading you get original file name with fake path ^^

Edited by ColdEdge
Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...