Skip to content

Commit

Permalink
fix upload for add form
Browse files Browse the repository at this point in the history
  • Loading branch information
Praesidiarius committed Mar 5, 2020
1 parent ce00716 commit 0610d63
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions module/Application/view/partial/basicformfield.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,27 @@ switch($oField->type) {
* Upload field
*/
case 'upload':
$sFile = $this->oItem->getTextField($oField->fieldkey);
if($sFile != '') {
$sExt = pathinfo($sFile)['extension'];
switch ($sExt) {
case 'jpg':
case 'jpeg':
case 'gif':
case 'png':
case 'svg':
echo '<img src="/data/' . str_replace(['##ID##'], [$this->oItem->getID()], $oField->url_list) . '/' . $sFile . '" style="max-width:600px; max-height:200px;" />';
echo $sFile;
break;
default:
echo $sFile;
break;
if(isset($this->oItem)) {
$sFile = $this->oItem->getTextField($oField->fieldkey);
if ($sFile != '') {
$sExt = pathinfo($sFile)['extension'];
switch ($sExt) {
case 'jpg':
case 'jpeg':
case 'gif':
case 'png':
case 'svg':
echo '<img src="/data/' . str_replace(['##ID##'], [$this->oItem->getID()], $oField->url_list) . '/' . $sFile . '" style="max-width:600px; max-height:200px;" />';
echo $sFile;
break;
default:
echo $sFile;
break;
}
}
}
?>
<input type="file" class="form-control" name="<?=$this->sFormName?>_<?=$oField->fieldkey?>"
value="<?=(isset($this->oItem)) ? '*****************' : ''?>"<?=$sExtraAttributes?> />
<input type="file" class="form-control" name="<?=$this->sFormName?>_<?=$oField->fieldkey?>"<?=$sExtraAttributes?> />
<?php
break;
/**
Expand Down

0 comments on commit 0610d63

Please sign in to comment.