The support forum is in archive (read-only) mode and access is limited to members with a purchase history.

For technical support, please visit our support page.

General questions or topics can also be discussed on the ExpressionEngine StackExchange.

   
 
Absoute server paths for {exp:cartthrob:download_file_form}
Posted: 01 May 2011 09:18 PM   [ Ignore ]
Wallflower
Rank
Total Posts:  5
Joined  2010-10-22

Hi,

Absolute links to files work fine for me, but when I try and use absolute server paths, i get:

A PHP Error was encountered

Severity: Notice

Message: Undefined index: host

Filename: libraries/Paths.php

Line Number: 46

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /var/www/system/codeigniter/system/core/Exceptions.php:170)

Filename: helpers/download_helper.php

Line Number: 86

then similar errors referencing lines 87-91 of download_helper.php

then the contents of the file displayed on the page. Is this a PHP misconfiguration on my end?

To clarify, this does not work:

{exp:cartthrob:download_file_form file="/var/www/file_storage/test.txt"}
    
<input type="submit" value="Download" /> 
{/exp:cartthrob:download_file_form} 

This does:

{exp:cartthrob:download_file_form file="http://www.domain.com/file_storage/test.txt"}
    
<input type="submit" value="Download" /> 
{/exp:cartthrob:download_file_form} 

Thanks,
Justin

Profile
 
 
Posted: 02 May 2011 09:11 AM   [ Ignore ]   [ # 1 ]
Absolute Heartthrob!
Avatar
RankRankRankRankRank
Total Posts:  10369
Joined  2008-09-29

Try changing line 46 of Paths.php to:

if (isset($url_info['host']) && strpos($_SERVER['SERVER_NAME']$url_info['host')) 
 Signature 
Profile
 
 
Posted: 02 May 2011 02:57 PM   [ Ignore ]   [ # 2 ]
Wallflower
Rank
Total Posts:  5
Joined  2010-10-22

That got it, thanks!

Profile