Thread: Youtube Videos
View Single Post
Old 02-17-2008, 09:35 PM   #11 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Theres nothing to give, I just upload the file as is and it gives me a blank file. It does the same with any address I put in there.

Anyway, here is a modification I made that truncates the name after 10 letters (you can set it differently if you want to).

PHP Code:
        public function asDownload()
        {
            
$szDownloadURL sprintf
            
(
                
self::URL_DOWNLOAD,
                
$this->m_aVideoData['video_id'],
                
$this->m_aVideoData['l_id'],
                
$this->m_aVideoData['t_id']
            );

            
$aHeaders get_headers($szDownloadURL1);
            
            if(
array_key_exists('Content-Length'$aHeaders))
            {
                
$iRemoteSize $aHeaders['Content-Length'];
            }
            
            
header('HTTP/1.1 200 OK');
            
header('Content-Type: video/flv');
            
            if(isset(
$iRemoteSize))
            {
                
header('Content-Length: ' $iRemoteSize);
            }
            
            if(
strlen($this->m_aVideoData['filename']) > 10)
            {
                
$DownloadFileName substr($this->m_aVideoData['filename'],0,10) . '...flv';
            }
            else
            {
                
$DownloadFileName $this->m_aVideoData['filename'];
            }
            
            
header('Content-Disposition: attachment; filename="' $DownloadFileName '"');
            
header('Content-Transfer-Encoding: Binary');
            
            
readfile($szDownloadURL);
        } 
__________________

Village Idiot is offline  
Reply With Quote