ich habe eine Downloadfunktion innerhalb einer Website.
Die Funktion greift auf eine Grafik/Dokument innerhalb eines Ordners zu, welcher mittels der Domain ersetzen Funktion umgeleitet wird.
Nun wird das Dokument nicht gefunden, welches heruntergeladen werden soll.
Wie kann ich das Problem bei einem Multidomain Projekt lösen?
Das ist meine Downloadfunktion:
Code: Alles auswählen
<div class="row">
<we:ifEditmode>Downloadlinks hinzufügen<hr /></we:ifEditmode>
<we:block name="Downloads">
<div class="downloads col-md-4">
<we:comment>document to be called is based on ForceDownload.tmpl</we:comment>
<we:ifEditmode><we:link name="DownloadLink" /></we:ifEditmode>
<we:setVar to="global" nameto="DownloadLinkHref" from="block" namefrom="DownloadLink" typefrom="link" />
<?php
//echo $GLOBALS['DownloadLinkHref'];
$GLOBALS['path_parts'] = pathinfo($GLOBALS['DownloadLinkHref']);
//Beispiel Dateiinformationsausgaben
//echo $path_parts['dirname'], "<br />";
//echo $path_parts['basename'], "<br />";
//echo $GLOBALS['path_parts']['extension'], "<br />";
//echo $path_parts['filename'], "<br />"; // seit PHP 5.2.0
//wandelt alle Dateiendungen in Kleinbuchstaben um
$GLOBALS['path_parts']['extension'] = strtolower($GLOBALS['path_parts']['extension']);
?>
<?php
if(!empty($GLOBALS['path_parts']['extension'])){
$imagePath = "/fiber.discount/sys-data/img/icn/file-icons/".$GLOBALS['path_parts']['extension'].".png";
//echo $imagePath;
$imageID = path_to_id($imagePath);
//echo $imageID;
}
?>
<we:img name="icon" id="\$imageID" thumbnail="FileIconDownload" showcontrol="false" showinputs="false" />
<we:ifNotEditmode><a href='<we:url type="document" id="35" />?file_path=<we:link name="DownloadLink" only="href" />'><we:link name="DownloadLink" only="text" /></a><br /></we:ifNotEditmode>
<we:ifEditmode>Kurze Dateibeschreibung: </we:ifEditmode>
<we:textarea wysiwyg="true" name="FileDescription" htmlspecialchars="true" commands="insertbreak,pastetext,pasteword,removeformat,removetags,lang,editsource,insertspecialchar" removefirstparagraph="true" inlineedit="false" />
<we:ifNotEditmode>
<we:ifVarNotEmpty match="FileDescription"><br /></we:ifVarNotEmpty>
<we:else />
<br />
</we:ifNotEditmode>
<i>
<?php
echo \$GLOBALS['path_parts']['basename'];
echo " - ";
\$file = \$GLOBALS['DownloadLinkHref'];
\$filesize = filesize(\$_SERVER['DOCUMENT_ROOT'].\$file);
\$array = array(
'YB' => 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024,
'ZB' => 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024,
'EB' => 1024 * 1024 * 1024 * 1024 * 1024 * 1024,
'PB' => 1024 * 1024 * 1024 * 1024 * 1024,
'TB' => 1024 * 1024 * 1024 * 1024,
'GB' => 1024 * 1024 * 1024,
'MB' => 1024 * 1024,
'KB' => 1024,
);
if(\$filesize <= 1024)
{
\$filesize = \$filesize . ' Bytes';
}
foreach(\$array AS \$name => \$size)
{
if(\$filesize > \$size || \$filesize == \$size)
{
\$filesize = round((round(\$filesize / \$size * 100) / 100), 2) . ' ' . \$name;
}
}
echo \$filesize;
?>
</i>
</div>
</we:block>
</div>