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...