• Extensions
  • FriendsOfFlarum upload, the intelligent file attachment extension

clarkwinkelmann MIME

Hello, my configuration is the default configuration, and the local network can't upload pictures. I previously configured advanced S3 storage settings to connect OSS object storage, but it's not good. The expansion of PHP has installed FileInfo, opcache and EXIF

Thank you for your help to see how and where the problem is. Thank you very much

    abczoujin I think you might have inserted a space between \ / in the MIME configuration. This causes the regex to contain an escaped space instead of escaped forward slash, end at / and PHP tries to read .* as a regex modifier. Try removing the space (correct raw value: image\/.*)

      clarkwinkelmann

      Thank you very much. After referring to other people's mime configuration, I can upload it
      Now I have another question about how to upload videos. Which tutorial is the tutorial for this plug-in to upload videos?

        Justoverclock the error appears to come from Flarum's tooltip component. Maybe it's because this extension switches its button content depending on the state of upload and Flarum tries to update the old button? Not sure 🤔

        abczoujin Which tutorial is the tutorial for this plug-in to upload videos?

        I don't think we have any tutorial. You can configure the MIME type for the desired file formats you want to allow, but FoF Upload doesn't have any built-in player. You could try to use the AutoVideo feature from FoF Formatting, but for anything more advanced you will need a different extension or get new features added to this one.

          5 days later

          Version 1.2.0

          • Added MIME inspection tool by @clarkwinkelmann
          • Added support for AWS instance credentials by @grimmdude
          • Improve empty file list styling on user profile by @datlechin

          The new MIME inspection tool is accessible through the FoF Upload admin page and lets you test what values will be detected by FoF Upload if that file was uploaded by a regular user.

          This is intended mostly for troubleshooting issues. Please be careful if copying MIME types from the inspection modal, as some MIME values are extremely broad and will allow a large range of actual file types.

          Screenshot

          9 days later

          Hi,

          I have a slight issue with this extension, when I upload a file that is about 25Kb with a resize of 700px, on the web page if I download the file it is much larger (over 100Kb) and the quality is poor.

          I am using local storage and version 1.2

          Any ideas?

          Sorry, I'm totally out of the loop, but it looks like freeflarum: you have "local" option enabled on freeflarum? (it's not on mine). There is a way to upload images on a FTP from freeflarum?

          6 days later

          I'm still interested is someone knows about this, because I just realized the imgur automatical upload extension is illegal – and therefore the associated account could be shut down, I have to find an alternative.

            TB54 I don't think freeflarum supports uploads. AWS is fairly cheap though as disk space in general isn't expensive. You could try that.

            • TB54 replied to this.

              luceos I didn't thought of AWS, as I already have a FTP (so not ideal to buy for space as I already have it), but it's maybe the best option indeed.

                TB54 Local isn't FTP. You would need an FTP adapter/driver for fof/upload. Something like that should be fairly easy to create as fof upload allows upload adapters to be added.

                • TB54 replied to this.

                  Oh, i thought it was the same thing (we reach my knowledge limits...)

                  luceos Something like that should be fairly easy to create as fof upload allows upload adapters to be added.

                  Well, I'm definitely not able to code that, but that would be a great option for the extension! Specially as I suppose a lot of people host flarum on a FTP (well, if I still understand what that means: I mean space for web hosting).

                  1.2.2

                  Updating
                  composer require fof/upload:"*"
                  php flarum cache:clear
                  5 days later

                  ⚠️ Recommened update

                  1.2.3

                  More information

                  • Addresses an XSS vulnerability if SVG files are allowed to be uploaded to the forum. SVG files are now sanitized and validated before proceeding. FriendsOfFlarum/upload318

                  Requires flarum/core 1.2.0 or above

                  Updating
                  composer require fof/upload:"*"
                  php flarum cache:clear
                  7 days later

                  I have found out that anyone can abuse this upload feature on my Flarum to upload unlimited photos and never actually post them instead they can use it somewhere else. Now it isn't that bad when imgur in ON but it is really a pain when the local option is ON. I will be getting a lot of spam images in my assets/files directory because of this.

                  do we have an option to purge the uploaded photos that aren't used anywhere in the Flarum discussions or in replies ?

                    r4nchy that's the main downside of this extension and as far as I understand it's close to impossible for this to be fixed. It would require an additional extension that performs rather free form search within posts to match against actually stored files and delete those that are not used anywhere. I considered writing my own Java program which would do that by using the Flarum REST API (to crawl through posts and check for images, file links, etc.) and also the Amazon AWS S3 bucket (the storage I use) and compare them and then remove the unused files. However I have no spare time for that (pretty busy with my day job and family time), so I never started work on that. I think the entire design of the FoF Upload extension is wrong from the ground up. They probably need to rewrite it, so that every upload is being tracked and every physically stored file has a corresponding DB entity which is then linked to every post where that file/image is being used. The current design doesn't allow for that.

                    5 days later

                    Would it be particularly difficult to modify this to also generate smaller thumbnails of the original?