• Extensions
  • FriendsOfFlarum upload, the intelligent file attachment extension

MrCaspan Question: When I did my test there was uuid value added. Where is this UUID generated from and does it HAVE to be there for the attachment to work?

The UUID references the file in the table I think, once added to the table it should be doable to use it in the bbcode added to the content of the post.

MrCaspan EDIT Also this does not seem like bbcode as I have that extension turned off.. But i am assuming you are meaning it acts like bbcode!

It's textformatter code I think.

Awesome thanks for that

So the UUID is just randomly generated and not tied to anything (IE Generated from UserName or a hash for that user to prove permissions or something)? If not I could just make up my Own UUIDs for the imported files?

Looks like Ill have to do some SQL and give each one a UUID then add that to the end of each post.

Is there a reason why attachments were added as in line apposed to under a post? Just curious more then its an issue? It would seem simpler no to just have a file associated with a post and it just shows up no?

    Also I am not sure if this is a bug or not but i uploaded about 5 things for a test in a few different posts to see the format used. When I went to my Media manager on my profile I could see the uploads and I decided to delete one. I went back to the post that had this attachment on it and the file download button was still there, but when you click it you get an error in JSON (for obvious reasons, the file is gone)

    {"errors":[{"status":"404","code":"not_found"}]}

    When you delete a file form "My media" should it not also remove any reference to that file in any post?

      MrCaspan So the UUID is just randomly generated and not tied to anything (IE Generated from UserName or a hash for that user to prove permissions or something)? If not I could just make up my Own UUIDs for the imported files?

      The UUID is time based, but it can be anything. The reason it is time based is to prevent it from clashing with an existing one. The reason UUID is used instead of an auto incrementing ID is to prevent clashes on highly volatile communities.

      MrCaspan Is there a reason why attachments were added as in line apposed to under a post? Just curious more then its an issue? It would seem simpler no to just have a file associated with a post and it just shows up no?

      That's how the implementation was/has been. There's never been a reason/request to add files as attachments to posts.

      MrCaspan I went back to the post that had this attachment on it and the file download button was still there, but when you click it you get an error in JSON (for obvious reasons, the file is gone)

      Yeah, when you delete a file from the media manager it doesn't delete the asset. There's a command I wrote some time ago that should clean things up, but it misbehaved in certain situations and was never fixed, but disabled, as far as I can tell

      thank you so much for this information this is so helpful.. also these plugins by fof are so amazing thank you to all the devs

      I'll probably look for the code that they use to generate the uuid for the files so that like you said a file 5 years from now won't clash with a random uuid that I created to fix this issue. but even if it did clash it would throw the error once and if they tried to upload again that conflict would no longer exist because time has passed.

      I was able to input all my attachments in the fof Upload with no issues so far. Ill share my PHP when I am done but I have a few questions first.

      It seems that post content's are wrapped in a <r> or a <t> tag. Do these tags stand for Text and Rich Text and rich text has to be rendered where text just gets outputted with no pre processing?

      I have noticed since enabling this extension that users pasting content will now automatically paste as an image and upload it. Is there a way to disable this behaviour? I only want to allow images to be uploaded using the buttton, not if pasting from the clipboard.

      The main issue is Excel, when pasting from Excel it automatically pastes as an image unless the user knows how to "paste as plain text." I am not sure if that behaviour is related to this extension or not, but of course prior to enabling this extension, data from Excel would always paste as plain text by default, which is the desired behaviour.

      Sorry another question does Flarum not have any native capability of uploading a file to a post? Do you always have to host it on the web to use in in the native Flarum?

        5 days later

        May I kindly remind the devs that zip upload has been broken since the latest update from 2 months ago. I’ve also opened a GitHub issue with no activity or acknowledgement.

          MrCaspan i dont understand the question. Flarum, for instance with this extensions, allows uploading files. For other to see these, they have to be uploaded onto a server that is connected to the internet.

          CyberGene open source sometimes is like that. And I can imagine these kind of issues drowning in the massive amount of notications someone, with many repositories to manage, gets.

            luceos i dont understand the question. Flarum, for instance with this extensions, allows uploading files. For other to see these, they have to be uploaded onto a server that is connected to the internet.

            Sorry does Falrum no have the support to upload an image for use in a post without this extension? Or does it only support the user uploading it somewhere else (Not Flarum) on the internet then using the Insert Image and put the URL to that image?

              MrCaspan this extension, or similar upload extensions, are necessary if you want to allow users to upload files to your community, this includes images. These files, by default, are stored in the same directory where flarum is installed. But you can choose to upload files elsewhere, like a cdn.

              Gotcha, I was just really surprised when I first Installed Flarum and could not find a way to add a photo to a post unless it was hosted somewhere else. I know everything is an extension just was surprised there was not one built in for simple photo uploads

              6 days later

              Hello,

              I'm getting this error after a user uploaded some files

              Deprecated: Optional parameter $upload declared before required parameter $contents is implicitly treated as a required parameter in /home/soniccit/public_html/forum/vendor/fof/upload/src/Adapters/Flysystem.php on line 55

              Fatal error: Uncaught Laminas\HttpHandlerRunner\Exception\EmitterException: Unable to emit response; headers already sent in /home/soniccit/public_html/forum/vendor/fof/upload/src/Adapters/Flysystem.php:55 in /home/soniccit/public_html/forum/vendor/laminas/laminas-httphandlerrunner/src/Exception/EmitterException.php:15 Stack trace: #0 /home/soniccit/public_html/forum/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitterTrait.php(38): Laminas\HttpHandlerRunner\Exception\EmitterException::forHeadersSent('/home/soniccit/...', 55) #1 /home/soniccit/public_html/forum/vendor/laminas/laminas-httphandlerrunner/src/Emitter/SapiEmitter.php(21): Laminas\HttpHandlerRunner\Emitter\SapiEmitter->assertNoPreviousOutput() #2 /home/soniccit/public_html/forum/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(75): Laminas\HttpHandlerRunner\Emitter\SapiEmitter->emit(Object(Laminas\Diactoros\Response\HtmlResponse)) #3 /home/soniccit/public_html/forum/vendor/flarum/core/src/Http/Server.php(45): Laminas\HttpHandlerRunner\RequestHandlerRunner->run() #4 /home/soniccit/public_html/forum/public/index.php(26): Flarum\Http\Server->listen() #5 {main} thrown in /home/soniccit/public_html/forum/vendor/laminas/laminas-httphandlerrunner/src/Exception/EmitterException.php on line 15

              Forum in question

              Any help?

              davetodave178 Just a gentle reminder that users still can’t delete files from the gallery, even if the permission is set to «users» 😅

              I’d also recommend paying attention to this comment. In my community, this extention is used constantly, so I have a large sample of complaints and suggestions — this is the most frequent one.

                davetodave178 Yes, I recorded a screencast. I’m referring to the image selection button.

                When uploading a new image to the gallery, it appears at the top. To send, you have to scroll all the way to the bottom of the page every time, and one finger scroll isn’t enough — you have to swipe again for the send button to appear. It would make more sense to pin the cancel and selection buttons.

                Can you make it possible to use both local upload and imgur
                so for example on my site i have a verified group i would like for people in the verified group to be able to upload to my site

                more normal users would use imgur

                how can i separate folder for local?