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

Check uploaded and listed files for mime type #2

Open
jofranz opened this issue Apr 1, 2021 · 0 comments
Open

Check uploaded and listed files for mime type #2

jofranz opened this issue Apr 1, 2021 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@jofranz
Copy link
Member

jofranz commented Apr 1, 2021

General

Currently we only check file endings (like docx) to verify if a file is of a current type. This sould better be handled by checking it's mime type.

Meanwhile used method to check file endings:
CRM_Civioffice_MimeType::hasSpecificFileNameExtension($file_name, CRM_Civioffice_MimeType::DOCX)

Approach

mime_content_type() can be used to check the mime type of a file.

Problems with this approach:

  • mime_content_type() is unable to access uploaded files as they are in a temp folder probalby somewhere in apache. The folder (/tmp/phpHNHdUd/) where this file should be doesn't exist. However move_uploaded_file() can access/move it
  • Besides the docx mimetype, this method also returns application/octet-stream or application/zip for only some files tested. We don't want to exclude these files, as they do work with our currently used unoconv converter
@jensschuppe jensschuppe added the enhancement New feature or request label Sep 7, 2023
@jensschuppe jensschuppe added this to the 1.1 milestone Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants