Hello, I am unable to find SVG file as an attachment:

PHP log is clean and apache log shows only error 500, network tools doesn't show anything. I tried to upload file while saving files to mysql and on drive but result was same.
I am however able to upload file to reply:

I have used these configurations but none of them worked:


I am able to upload .png, .jpg, .pdf and other file types.
Osticket information page:

This is the file I am trying to upload:

erikpahlberg

Right click the page, click Inspect, click Network, make sure you check the box to Preserve Logs, upload the file, click on the upload request, look at the Response, and see if it gives you a more detailed error.

Cheers.

Invalid File - is the response.

Request headers:
Content-Length: 5257
content-type: multipart/form-data; boundary=------multipartformboundary1677683054727

    KevinTheJedi
    file --mime-type /home/erik/logopinguin.svg
    /home/erik/logopinguin.svg: image/svg+xml
    and from network tab:

    Tried with same version PHP that Osticket is running:
    echo mime_content_type('logopinguin.svg') . "\n";

    image/svg+xml

      erikpahlberg

      This method is returning false:

      So either the file couldn't be uploaded on the server (ie. no tmp_name), the file type does not include image/ (which is not the case here), or the exif_imagetype does not pass. You can add some var_dump(); statements in that function to see what's missing or what's failing.

      Cheers.

      static function isValidFile($file) {

          // Check invalid image hacks
          if ($file['tmp_name']
              && stripos($file['type'], 'image/') === 0
              && strpos(mime_content_type($file['tmp_name']), 'image/') === False) {
            return false;
            }
          return true;

      }

      I changed the function and now it seems to work. I am not a programmer so if you have better solution then I am all ears 🙂 But is it possible for you to look over this and maybe include it in next release?
      Thank you for your help!!!

        erikpahlberg

        That's just a band-aid, not an actual fix. It may work for you but not how it's intended to work. So no, this will not be included in the next release.

        Cheers.

        Write a Reply...