Upload xlsx files

See all posts See thread Reply

Re: Upload xlsx files new!
by Ray, 1 year, 5 months ago
In addition:
I created myself files .xlsx and .xls and upload works fine.
Is it possible that the customer files are corrupt in some way though the file obviously opens and reads fine?Reply
Re: Upload xlsx files new!
by colin, 1 year, 5 months ago
On your OS (LInux), the class uses FileInfo PECL extension to detect MIME type, and it detects application/encrypted, which is very generic, and dangerous to allow.

You may try to deactivate FileInfo in order to rely instead on Unix file command: deactivate the code using fileinfo in the class. Search for this line in the class:
$this->mime_fileinfo            = true;
And replace it with
$this->mime_fileinfo            = false;
Reply
Re: Upload xlsx files new!
by Ray, 1 year, 5 months ago
I set mime_fileinfo to false, upload failed

system information
- class version : 30/08/2022
- operating system : Linux
- PHP version : 8.1.2
- GD version : 2.2.4
- supported image types : png webp jpg gif bmp
- open_basedir : /var/customers/webs/test3:/var/customers/tmp/test3:/usr/share/php:/usr/share/php5:/tmp
- upload_max_filesize : 64M (67108864 bytes)
- language : de_DE
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Fileinfo PECL extension deactivated
- checking MIME type with UNIX file() command
PHP exec() function is disabled
- checking MIME type with mime.magic file (mime_content_type())
MIME type detected as application/encrypted by mime_content_type()
- MIME validated as application/encrypted
source variables
- you can use all these before calling process()
file_src_name : GAR_Datenbank_aktuell_2022_10_10_NEW.xlsx
file_src_name_body : GAR_Datenbank_aktuell_2022_10_10_NEW
file_src_name_ext : xlsx
file_src_pathname : /var/customers/tmp/test3/phppuQ5QX
file_src_mime : application/encrypted
file_src_size : 415232 (max= 67108864)
file_src_error : 0
process file to /var/customers/webs/test3/dskom/media/uploaders_649615/71/in/
- file size OK
- MIME type and/or extension is not allowed !
- error: Falscher Dateityp.
Reply
Re: Upload xlsx files new!
by colin, 1 year, 5 months ago
Your PHP setup doesn't allow exec(), so you cannot use the Unis file command. And the next available method is mime.magic, but here again your file is detected as application/encrypted.

You need to set up your OS so that MIME detection returns something more meaningful for your files.Reply
Re: Upload xlsx files new!
by Ray, 1 year, 5 months ago
Thanks for info.
I thought allow exec() would be a risk?!
So I can remove it from the array.Reply
Re: Upload xlsx files new!
by Ray, 1 year, 5 months ago
Removed exec from php configuration but result is still the same-> upload failed.
I suppose the files are corrupt or something inside the files prevent the correct upload, may some filters or entries etc.
As upload succeeded with xlsx files created on my own there is no need for further investigations.
Thank you for quick answering and help, I appreciate your work.Reply