Jump to content


Photo

No Mime Type


  • Please log in to reply
2 replies to this topic

#1 jaymc

jaymc
  • Members
  • PipPipPip
  • Advanced Member
  • 1,521 posts
  • LocationLiverpool

Posted 16 October 2006 - 11:33 PM

I think No Mime Type is the correct subject title for this

Basically, I have made a PM system, which allows attatchments

The way it works, if a message has an attatchment the link to the file will be included.

However, on clicking the direct link to the file I dont want it to load up in its default application

For example, if its an MP3 I dont want it to load in windows media player

How can I get it so that no matter what file type it is, it will always ask you to SAVE AS

Thanks
I would love to change the world, but they won't give me the source code

SEO Agency

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 16 October 2006 - 11:49 PM

Look at the header function for examples.

#3 jaymc

jaymc
  • Members
  • PipPipPip
  • Advanced Member
  • 1,521 posts
  • LocationLiverpool

Posted 17 October 2006 - 12:24 AM

Ive got this code and it is working, but their is one problem

Sometimes, and i think this is random, when clicking save it only saves like 170k of the file

Running it again to try and download the same file and it downloads it in full

Just wondering why this is happening?

<?
$file = $_GET['file'];
if (strstr($file, "../")) {die("Unlucky Punk");}
$filesize = filesize($file);
    header("Content-length: ".$filesize);
    header("Pragma: public");
    header("Expires: 0"); // set expiration time
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Type: application/force-download");
    header("Content-Type: application/octet-stream");
    header("Content-Type: application/download");
    header("Content-Disposition: attachment; filename=Jaydiocity_$file");
    header("Content-Transfer-Encoding: binary");


readfile("./uploads/".$file);
?>

I would love to change the world, but they won't give me the source code

SEO Agency




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users