codefog / contao-haste

Haste is a collection of tools and classes to ease working with Contao
http://codefog.pl/extension/haste.html
MIT License
43 stars 24 forks source link

Form: File/ Image Upload? #141

Closed mucka-veli closed 5 years ago

mucka-veli commented 5 years ago

I've been trying to implement into a form and so far have been successful. However in the databank all I get is "0x000000000000000000000000000" as a value of the upload. Could you please explain how excactly I need to set this up to work?

Here is my codes so far:

$objForm->addFormField('tvupload', array( 
                            'label'         => 'Datei', 
                            'inputType'     => 'upload', 
                            'eval'          => array( 
                                /* // aus core/forms/FormFileUpload.php 
                                * @property boolean $mandatory 
                                * @property integer $maxlength 
                                * @property integer $fSize 
                                * @property string  $extensions 
                                * @property string  $uploadFolder 
                                * @property boolean $doNotOverwrite 
                                */ 
                                'mandatory'        => false, 
                                'maxlength'        => \Config::get('maxFileSize'), 
                                'fSize'                => \Config::get('maxFileSize'), 
                                 //'extensions'     => \Config::get('uploadTypes'), // aus den systemweiten Einstellungen 
                                 'extensions'        => $this->projectModel->extensions, // aus Projektkonfiguration 
                                 'uploadFolder'     => $objUploadDirectory->uuid, 
                                 'doNotOverwrite' => '1', // Datei nicht überschreiben (Versionsnummer anhängen) 
                                 'storeFile'           => '1', // Datei speichern 
                            ) 
                        ));  
aschempp commented 5 years ago

This is not really related to Haste. The FormFileUpload does not store the files in it's value, so you have to manually handle it.