WebsiteBaker Community Forum

WebsiteBaker Support (2.12.x) => Modules => Topic started by: CodeALot on July 25, 2019, 12:34:54 PM

Title: Plupload problem with filenames and large files in OneForAll
Post by: CodeALot on July 25, 2019, 12:34:54 PM
OneForAll uses PLUPLOAD to handle the upload of images.

What needs to be changed to have PLUPLOAD handle/alter the filename upon saving? It refuses filenames with special characters (copyright-sign, for instance) and does not replace spaces (should be, to avoid validation errors).

Also, I've noticed that PLUPLOAD does not accept large files. If I try to upload an image of say 9 MB, it will come back with the error "Filename already exists". 
Then, when I save the OFA-item and go back into it, I see that the large image was in fact partially saved.
Something goes wrong with the storing of the file, it seems.

WB-version 2.12.2
OFA version 2.0.2.23
PHP 7.3
Title: Re: Plupload problem with filenames and large files in OneForAll
Post by: dbs on July 25, 2019, 01:15:23 PM
Hi, try this:
oneforall/ajax/upload.php line 222
Comment out this line
Code: [Select]
$filename   = str_replace(' ', '_', $filename);          // Replace spaces by underscoresadd this line below
Code: [Select]
$filename = media_filename($filename);
@ will be removed. if you want to convert it to something, change the line to
Code: [Select]
$filename = media_filename(str_replace('@', '-at-', $filename));
Info: the function media_filename() comes from framework/functions.php

Large files can't be uploaded if your hoster do not allow this file size or the needed time for this.
Keywords are max_file_size, max_execution_time and more.
It is planned to convert the files before uploading.
Title: Re: Plupload problem with filenames and large files in OneForAll
Post by: CodeALot on July 25, 2019, 02:05:39 PM
Hi , thanks for your reply.

But... you mean UNcomment, right? If I comment out those lines, they won't do anything...

Hi, try this:
oneforall/ajax/upload.php line 222
Comment out this line
Code: [Select]
$filename   = str_replace(' ', '_', $filename);          // Replace spaces by underscoresadd this line below
Code: [Select]
$filename = media_filename($filename);
@ will be removed. if you want to convert it to something, change the line to
Code: [Select]
$filename = media_filename(str_replace('@', '-at-', $filename));
Info: the function media_filename() comes from framework/functions.php

Large files can't be uploaded if your hoster do not allow this file size or the needed time for this.
Keywords are max_file_size, max_execution_time and more.
It is planned to convert the files before uploading.

Yeah, I resize the images now before uploading but it would be nice to be able to upload big files straight from cameras, for instance :)
Title: Re: Plupload problem with filenames and large files in OneForAll
Post by: dbs on July 25, 2019, 02:18:06 PM
Yes, sorry, i mean comment the line 222. this line should do nothing.
Code: [Select]
// $filename   = str_replace(' ', '_', $filename);          // Replace spaces by underscoresBecause the next new line do the work. :-)