• Extensions
  • FriendsOfFlarum upload, the intelligent file attachment extension

I get "Uploading files of this type is not allowed." when I set up S3 adapter and disable local. Does anyone know how it should be configured?

I am using a Minio instance as S3 endpoint. I have a MIME adapter mapping set to ^image\/.*, S3/Compatible, Default image download template.

    rongcuid "Uploading files of this type is not allowed."

    This usually implies the regex is incorrect. Please share the exact settings by creating and attaching a screenshot 😉

      luceos

      The error has actually changed to "Oops" with 500 error. Now, I don't know how to upload an image here... but here are some settings, pasted verbatim:

      • The regex: ^image\/.*, S3, Default image download template
      • Key/Secret: they are from a Service Account created in Minio. Not going to paste here.
      • Bucket: flarum, a bucket created in Minio
      • Endpoint: http://home.local:9000

      Also, bucket policy:

      {
          "Version": "2012-10-17",
          "Statement": [
              {
                  "Sid": "AllowPublicRead",
                  "Effect": "Allow",
                  "Principal": {
                      "AWS": [
                          "*"
                      ]
                  },
                  "Action": [
                      "s3:GetObject"
                  ],
                  "Resource": [
                      "arn:aws:s3:::flarum/*"
                  ]
              }
          ]
      }

      After some testing, I am getting 403 forbidden from my S3 bucket. If someone has done Minio + Flarum Upload, I'd be grateful if they share their experience.

      luceos ok,I think I will make a simple extension to this,thanks for help~

      10 days later

      it worked great!
      but i can't upload animated gif
      how can i fix it?

        jhwandev I think you need to allow image\/gif specifically, but I might be wrong. What have you tried so far?

        7 days later

        Hey I'm having an issue with the "My Media" profile page after doing an import to Flarum and I'm wondering if anyone has any ideas what's wrong.

        This is the page /u/{username}/uploads and the error on page is the "Oops!" error.

        The actual error and first bit of the stack trace:

        Error: Call to a member function preview() on array in /Users/linc/code/flarum/packages/upload/src/Helpers/Util.php:153
        Stack trace:
        #0 /Users/linc/code/flarum/packages/upload/src/Api/Serializers/FileSerializer.php(46): FoF\Upload\Helpers\Util->getBbcodeForFile(Object(FoF\Upload\File))
        #1 /Users/linc/code/flarum/packages/core/src/Api/Serializer/AbstractSerializer.php(88): FoF\Upload\Api\Serializers\FileSerializer->getDefaultAttributes(Object(FoF\Upload\File))
        #2 /Users/linc/code/flarum/vendor/tobscure/json-api/src/Resource.php(169): Flarum\Api\Serializer\AbstractSerializer->getAttributes(Object(FoF\Upload\File), NULL)
        #3 /Users/linc/code/flarum/vendor/tobscure/json-api/src/Resource.php(75): Tobscure\JsonApi\Resource->getAttributes()
        #4 /Users/linc/code/flarum/vendor/tobscure/json-api/src/Collection.php(123): Tobscure\JsonApi\Resource->toArray()
        #5 [internal function]: Tobscure\JsonApi\Collection->Tobscure\JsonApi\{closure}(Object(Tobscure\JsonApi\Resource))
        #6 /Users/linc/code/flarum/vendor/tobscure/json-api/src/Collection.php(124): array_map(Object(Closure), Array)
        #7 /Users/linc/code/flarum/vendor/tobscure/json-api/src/Document.php(181): Tobscure\JsonApi\Collection->toArray()

        I'm not currently populating the upload_method, uuid, or tag columns, but this error is a wrong datatype which makes me wonder if it's something deeper.

        Oh, this is probably the code assuming the tag has to exist here: $template = $this->getTemplate($file->tag);

        I'll see if I can sort out how to set those.

        I'd consider bulletproofing that code a bit.

        can anyone add FTP external storage server to this extension? I even will pay for that.
        I just want uploaded files save to another server via FTP connection.

        a month later

        I am trying to upload microsoft documents. I got the mime types added but when I try to upload a docx file or pptx file I get an error saying those are not supported.

        video\/(3gpp|mp4|mpeg|quicktime|webm))|(audio\/(aiff|midi|mpeg|mp4))|(image\/(gif|jpeg|png))|(application\/(x-(7z|rar|zip)-compressed|zip|arj|x-(bzip2|gzip|lha|stuffit|tar)|pdf|Vnd.openxmlformats-officedocument.wordprocessingml.document|Vnd.openxmlformats-officedocument.presentationml.presentation|Vnd.openxmlformats-officedocument.spreadsheetml.sheet|msword|vnd.ms-powerpoint|vnd.ms-excel))

          Davippi I use this:
          ^application\/(x-(7z|rar|zip)-compressed|zip|gzip|arj|x-(bzip2|gzip|lha|stuffit|tar)|pdf|msword|vnd.openxmlformats-officedocument.wordprocessingml.document|vnd.ms-excel|vnd.openxmlformats-officedocument.spreadsheetml.sheet|vnd.ms-powerpoint|vnd.openxmlformats-officedocument.presentationml.presentation)

          luceos
          I test to add the "minimum-stability": "dev""prefer-stable": true or require"fof/upload": "1.3.0@dev" to composer.json,but composer tell me

            Problem 1
              - Root composer.json requires fof/upload 1.3.0@dev, found fof/upload[dev-dw/fix-upload-button-size, dev-cw/mime-inspector, dev-dk/edit-modal, dev-dk/image-in-private-discussions, dev-dependabot/npm_and_yarn/js/terser-5.14.2, dev-dk/beta-14, dev-master, dev-beta13, 0.1.0, ..., 0.14.0, 1.0.0, ..., 1.2.3] but it does not match the constraint.

          Look like composer can't find tag 1.3.0@dev?

            MIKU-N if you want to install 1.3.0 just use composer require fof/upload:1.3.0, I'm not sure why you're looking to install the dev version?

              luceos 1.2.3 is the latest full release, 1.3.x only exists as 1.3.0-dev and 1.3.0-dev.2

              I've not been following the latest developments with fof/upload, so not sure why this is atm...

                luceos
                Do you test this command?I want say the Composer can't find the 1.3.0 version,all tag just that:
                fof/upload[dev-dw/fix-upload-button-size, dev-cw/mime-inspector, dev-dk/edit-modal, dev-dk/image-in-private-discussions, dev-dependabot/npm_and_yarn/js/terser-5.14.2, dev-dk/beta-14, dev-master, dev-beta13, 0.1.0, ..., 0.14.0, 1.0.0, ..., 1.2.3
                Look like no 1.3.0 version……,but I see 1.3.0 version in github tag?I don't know why composer can't find 1.3 version......

                IanM
                The 1.3.x is not release version,so I test to use dev command...
                So I want use 1.3.x only use the dev-master tag in Composer?
                The command like composer require fof/upload:dev-master ?
                But I see the 1.3.x in Github Release Tags?Why Composer can't find it?

                • IanM replied to this.

                  MIKU-N unless it's absoltely essential, never use dev-master in production

                  Try
                  composer require fof/upload:"1.3.0-dev.2"

                  Untested, but that should work 🤞

                    MIKU-N oh now I understand, do the following:

                    composer config prefer-stable true
                    composer config minimum-stability beta
                    composer require fof/upload:"1.3.0@beta"

                    I tagged 1.3.0-beta.1 to help with the installation.