Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YForm Upload als Download bereitstellen #361

Open
alxndr-w opened this issue Mar 31, 2024 · 0 comments
Open

YForm Upload als Download bereitstellen #361

alxndr-w opened this issue Mar 31, 2024 · 0 comments

Comments

@alxndr-w
Copy link
Member

Feature description / Feature Beschreibung

Code in Slack aufgeschnappt. Wichtig ist vor allem der Teil, wie man einfach zum Datensatz einen Pfad generiert:

$path = rex_path::pluginData('yform', 'manager', 'upload/'.$dataset->getTableName().'/'.$field.'/'.$dataset->getValue('id').'_'.$dataset->getValue($field)); 

Beispiel:

<?php
use Url\Url;
$manager = Url::resolveCurrent();
if ($manager) {
$id = $manager->getDatasetId();

$field = 'yfile';    
$dataset = rex_yform_manager_dataset::get($id, 'rex_downloads');  
$path = rex_path::pluginData('yform', 'manager', 'upload/'.$dataset->getTableName().'/'.$field.'/'.$dataset->getValue('id').'_'.$dataset->getValue($field)); 
dump($dataset);

if (file_exists($path)) {
            rex_response::cleanOutputBuffers();
            rex_response::sendFile($path,'application-pdf','inline',$dataset->yfile);
        }     
}    
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant