Answer the question
In order to leave comments, you need to log in
Bitrix download link not working?
Good afternoon!
I'm trying to create an infoblock in Bitrix that gives a link to download the file.
I use this design
<?$pdf = CFile::GetPath($arResult['PROPERTIES']['PDF']['VALUE']);?>
<a href="<?=$pdf;?>" class="file-types-link" download>pdf</a>
Answer the question
In order to leave comments, you need to log in
First, check that you have a file ID passed in $arResult['PROPERTIES']['PDF']['VALUE'] .
If everything is fine and an integer is transmitted (for example, "33", etc.), then try this:
<?$pdf = CFile::GetFileArray($arResult['PROPERTIES']['PDF']['VALUE']);?>
<a href="<?=$pdf["SRC"];?>" class="file-types-link" download>pdf</a>
You must first check what $arResult['PROPERTIES']['PDF']['VALUE'] contains.
<?if(IntVal($arResult['PROPERTIES']['PDF']['VALUE']) > 0):
$pdf = CFile::GetPath($arResult['PROPERTIES']['PDF']['VALUE']);?>
<a href="<?=$pdf;?>" class="file-types-link" download>pdf</a>
<?endif;?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question