Changeset 1632


Ignore:
Timestamp:
1/22/2010 12:35:08 AM (5 years ago)
Author:
lowjoel
Message:

Suggest the name of the download when it is requested, instead of the name of the file on disk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/website/scripts/downloads.php

    r1631 r1632  
    2222         
    2323        if (preg_match('/http(s{0,1}):\/\/(.*)/', $this->Link)) 
     24        { 
    2425            header('location: ' . $this->Link); 
     26        } 
    2527        else if (substr($this->Link, 0, 1) == '?') 
    26             Download::DownloadFile(substr($this->Link, 1)); 
     28        { 
     29            //Get a name to call the file. 
     30            $pathInfo = pathinfo(substr($this->Link, 1)); 
     31            Download::DownloadFile(substr($this->Link, 1), 
     32                sprintf('%s.%s', $this->Name, $pathInfo['extension'])); 
     33        } 
    2734        else 
     35        { 
    2836            throw new Exception('Unknown download link'); 
     37        } 
    2938    } 
    3039     
Note: See TracChangeset for help on using the changeset viewer.