pingcrm icon indicating copy to clipboard operation
pingcrm copied to clipboard

Improve file upload

Open sudo-barun opened this issue 4 months ago • 0 comments

Changes:

  1. remove support for SVG file: Even though Laravel accepts SVG as valid image type, SVG files are not displayed correctly in the app right now. For URL such as http://localhost:8081/img/users/1WWm9JJumSkEwhIIZYohNtrL2GYQtxBGAPJIoXgW.svg?w=40&h=40&fit=crop, 500 Internal Server Error occurs with following message:
    Unsupported image type image/svg+xml. GD driver is only able to decode JPG, PNG, GIF, BMP or WebP files.
    
    Also, Laravel has stopped supporting SVG files for image validation rule starting from version 12. Following message is displayed in https://laravel.com/docs/12.x/validation#rule-image :
    By default, the image rule does not allow SVG files due to the possibility of XSS vulnerabilities. If you need to allow SVG files, you may provide the allow_svg directive to the image rule (image:allow_svg).
    
    So, it makes sense to remove support for SVG file in the app.
  2. remove useless attribute: type="file" was used with <file-input> which is useless.
  3. fix: file-input validation error not showing: Validation error for photo field in Users/Create and Users/Edit was not working which has been fixed.

sudo-barun avatar Aug 03 '25 03:08 sudo-barun