Error when protecting file with script in fileupload plugin

miss.take

New Member
Hi all,
When I try to protect my files with the download script I get this error:

Warning: preg_match() expects parameter 2 to be string, object given in /plugins/fabrik_element/fileupload/adaptors/filesystemstorage.php on line 518

Recoverable fatal error: Object of class stdClass could not be converted to string in /plugins/fabrik_element/fileupload/adaptors/filesystemstorage.php on line 520

joomla 3.9.14 stable
php 7.2.26
mysql 5.7.26-29-log
Fabrik 3.9

Need something more?
My settings in the field are attached as screenshot.

Nothing similar found on the forum.
Any idea?
Thanks.
V.
 

Attachments

  • Fabrik  modifica elementi.png
    Fabrik modifica elementi.png
    92.9 KB · Views: 91
Last edited:
I can't replicate.
Which settings? (ajax, crop, thumb, ..., repeat group...)
Error in form, list, details view?
 
Hi troester and thanks in advance.
My settings are simple, beacause the upload is intended to only let add pdfs.
What I want to do is to protect the folder using htacces, so I really need the download script for privacy reasons.
I set the downnload by script option for both the list and details, but for the moment I only want to see the button in the details, where the erros actully occours.
You can find all the settings and the frontend screenshot attached.
Hope it helps... to help me...
Thanks another time!
V.
 

Attachments

  • 2020-05-11-16_16_49.png
    2020-05-11-16_16_49.png
    138.6 KB · Views: 100
  • 2020-05-11-16_17_38.png
    2020-05-11-16_17_38.png
    116.8 KB · Views: 99
  • 2020-05-11-16_18_01.png
    2020-05-11-16_18_01.png
    101 KB · Views: 91
  • 2020-05-11-16_18_31.png
    2020-05-11-16_18_31.png
    95.6 KB · Views: 108
  • 2020-05-11-16_18_51.png
    2020-05-11-16_18_51.png
    116.1 KB · Views: 99
  • 2020-05-11-16_19_16.png
    2020-05-11-16_19_16.png
    95.1 KB · Views: 100
  • 2020-05-11-16_19_39.png
    2020-05-11-16_19_39.png
    103.4 KB · Views: 94
  • 2020-05-11-16_19_58.png
    2020-05-11-16_19_58.png
    85.9 KB · Views: 105
  • Candidatura e gestione profilo.png
    Candidatura e gestione profilo.png
    68.4 KB · Views: 93
The error occurs with Ajax upload= yes and max files=1.
So if you can set max to 2 do it.

Otherwise as a workaround you can hack the code (on your own risk). In plugins\fabrik_element\fileupload\fileupload.php before the line
$filePath = $storage->getFullPath($filePath); (around line no 3516) add
Code:
        if (is_object($filePath))
        {
            $filePath = $filePath->file;
        }
 
Dear Troester...
Sorry but I cannot find this code.
That's what's inside the file you mentioned:

Code:
    Line 1075:         $filePath = $this->_getFilePath($repeatCounter);
    Line 1432:             foreach ($crop as $filePath => $json)
    Line 2037:         $filePath = $this->_getFilePath($repeatGroupCounter);
    Line 2051:                     $filePath = Uploader::incrementFileName($filePath, $filePath, 1, $storage);
    Line 2067:         $filePath = $storage->getUploadedFilePath();
    Line 2870:             $filePath = $this->_processIndUpload($file, '', 0);
    Line 3399:         $filePath = $row->$elName;
    Line 3400:         $filePath = FabrikWorker::JSONtoData($filePath, false);
    Line 3401:         $filePath = is_object($filePath) ? FArrayHelper::fromObject($filePath) : (array) $filePath;
    Line 3427:         $filePath = FArrayHelper::getValue($filePath, $repeatCount);
    Line 3433:                 $filePath = FArrayHelper::getValue($filePath, $ajaxIndex);
    Line 3635:         $filePath = $this->_getFilePath($repeatCounter, false);
    Line 3636:         $filePath = str_replace(JPATH_SITE, '', $filePath);

Tried to inject the hack before the 2067 line with no success: the download by script button simply point to a blank page.
Reversed the hack I definitely set to 2 files the maximum upload and now seems to work.
But I really need to set the max file to 1. Any workaround? Also using javascript?
Thanks.
Valerio
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top