• Extensions
  • FriendsOfFlarum upload, the intelligent file attachment extension

mabioca version 1.6 requires PHP 8.0+. Version 1.7 requires PHP 8.1+.

I'm not sure if we can get more information through the Extension Manager. If you try installing via SSH you could composer require fof/upload:"^1.7" to see what exactly prevents installation of that version.

    clarkwinkelmann Thank you. My website is currently running PHP version 8.2 on shared hosting. Unfortunately, it does not have SSH access.

    So I had the same problem within extension manager. I used composer to run:
    composer2 require fof/upload:"^1.7"

    Got the following error:
    `Problem 1
    - Root composer.json requires fof/upload 1.7 -> satisfiable by fof/upload[1.7.0].
    - fof/upload 1.7.0 requires softcreatr/php-mime-detector 4.0 -> found softcreatr/php-mime-detector[4.0.0] but the package is fixed to 3.2.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

    Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.`

    Went ahead and updated dependencies through composer, which increased php-mime-detector version to 4.0. I then went back to extension manager, which successfully updated the extension.

    I have php 8.2.15 by the way.

    8 days later

    Hi, i tried to install it, but i can't activate it.

    I have this log but don't know, how to deal with it : Next Illuminate\Database\QueryException: SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'community_pub_fof_upload_files_actor_id_hide_from_media_manager_index' is too long (SQL: alter table community_pub_fof_upload_files add index community_pub_fof_upload_files_actor_id_hide_from_media_manager_index(actor_id, hide_from_media_manager)) in /home/server/community.com/vendor/illuminate/database/Connection.php:712

      deban your long database table prefix might be causing the issue. Unfortunately Flarum and its extensions have no way to control the length of MySQL index names, which automatically get named with the table prefix, table name and column name, sometimes resulting in very long names that MySQL rejects.

      To work around this, you would have to identify which migration is causing the issue and find its file in vendor/fof/upload/migrations. If the migration consists of a single statement or the problematic statement is the first in the file, then you can edit that file to manually specify an alternate index name. If the migration contains multiple statements, you would have to comment out the statements that have already been successfully performed and then modify the remaining statements to specify a hard-coded index name. Or alternatively, look at the contents of the migration file, manually create the tables, columns and index in the database, then manually add the migration name to the migrations table to indicate it has been performed.

      If you are reinstalling Flarum at any point, I strongly recommend to choose a setup where no database table prefix is necessary. Unfortunately it's a bit complicated to remove a prefix on an existing database.

      Hi!

      I just wanted to report an unexpected behavior of the extension. Maybe that's by design, but maybe worth to check, so I'll just ask.

      Let's say, for the files of type "text\/plain" I select "Default file download template" (in the extension's admin). After a user adds a file to a post, it doesn't appear in the fof_upload_file_posts table.

      However, if I select "Text preview" or "Just URL" - a new row will be added to the table, after the file is added to the post.

      Is this by design? And if not - could you please point me to the place in the code I can change this behavior? I would like all the files being added to this table (I'm working on an extension that depends on files).

      Thank you!

      Best regards
      Maciej

      12 days later

      After I updated the extension to 1.7, uploading zip files stopped working. Here's the error:

      [2024-12-25 07:28:22] flarum.ERROR: TypeError: FoF\Upload\Repositories\FileRepository::sanitizeSvg(): Argument #2 ($mime) must be of type string, null given, called in /home/customer/www/myforum.com/public_html/forum/vendor/fof/upload/src/Commands/UploadHandler.php on line 72 and defined in /home/customer/www/myforum.com/public_html/forum/vendor/fof/upload/src/Repositories/FileRepository.php:342
      Stack trace:
      #0 /home/customer/www/myforum.com/public_html/forum/vendor/fof/upload/src/Commands/UploadHandler.php(72): FoF\Upload\Repositories\FileRepository->sanitizeSvg(Object(Symfony\Component\HttpFoundation\File\UploadedFile), NULL)
      #1 [internal function]: FoF\Upload\Commands\UploadHandler->{closure:FoF\Upload\Commands\UploadHandler::handle():64}(Object(Laminas\Diactoros\UploadedFile), 0)
      #2 /home/customer/www/myforum.com/public_html/forum/vendor/illuminate/collections/Collection.php(695): array_map(Object(Closure), Array, Array)
      #3 /home/customer/www/myforum.com/public_html/forum/vendor/fof/upload/src/Commands/UploadHandler.php(64): Illuminate\Support\Collection->map(Object(Closure))
      #4 /home/customer/www/myforum.com/public_html/forum/vendor/illuminate/bus/Dispatcher.php(122): FoF\Upload\Commands\UploadHandler->handle(Object(FoF\Upload\Commands\Upload))
      #5 /home/customer/www/myforum.com/public_html/forum/vendor/illuminate/pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->{closure:Illuminate\Bus\Dispatcher::dispatchNow():119}(Object(FoF\Upload\Commands\Upload))
      #6 /home/customer/www/myforum.com/public_html/forum/vendor/illuminate/pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->{closure:Illuminate\Pipeline\Pipeline::prepareDestination():126}(Object(FoF\Upload\Commands\Upload))
      #7 /home/customer/www/myforum.com/public_html/forum/vendor/illuminate/bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
      #8 /home/customer/www/myforum.com/public_html/forum/vendor/illuminate/bus/Dispatcher.php(78): Illuminate\Bus\Dispatcher->dispatchNow(Object(FoF\Upload\Commands\Upload))
      #9 /home/customer/www/myforum.com/public_html/forum/vendor/fof/upload/src/Api/Controllers/UploadController.php(60): Illuminate\Bus\Dispatcher->dispatch(Object(FoF\Upload\Commands\Upload))
      #10 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php(116): FoF\Upload\Api\Controllers\UploadController->data(Object(Laminas\Diactoros\ServerRequest), Object(Tobscure\JsonApi\Document))
      #11 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Flarum\Api\Controller\AbstractSerializeController->handle(Object(Laminas\Diactoros\ServerRequest))
      #12 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->{closure:Flarum\Http\RouteHandlerFactory::toController():36}(Object(Laminas\Diactoros\ServerRequest), Array)
      #13 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\ExecuteRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Closure))
      #14 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Api/Middleware/ThrottleApi.php(33): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #15 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Api\Middleware\ThrottleApi->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #16 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(44): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #17 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\CheckCsrfToken->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #18 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(69): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #19 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\ResolveRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #20 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/SetLocale.php(51): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #21 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\SetLocale->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #22 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(58): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #23 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\AuthenticateWithHeader->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #24 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(31): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #25 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\AuthenticateWithSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #26 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(52): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #27 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\RememberFromCookie->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #28 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #29 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\StartSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #30 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(29): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #31 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Api\Middleware\FakeHttpMethods->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #32 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #33 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\ParseJsonBody->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #34 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #35 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\HandleErrors->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #36 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/InjectActorReference.php(25): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #37 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\InjectActorReference->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #38 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(81): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #39 /home/customer/www/myforum.com/public_html/forum/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #40 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Middlewares\RequestHandler->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #41 /home/customer/www/myforum.com/public_html/forum/vendor/middlewares/base-path-router/src/BasePathRouter.php(99): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #42 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Middlewares\BasePathRouter->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #43 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(36): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #44 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Laminas\Stratigility\Middleware\OriginalMessages->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #45 /home/customer/www/myforum.com/public_html/forum/vendor/middlewares/base-path/src/BasePath.php(73): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #46 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Middlewares\BasePath->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #47 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Middleware/ProcessIp.php(24): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #48 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/Next.php(52): Flarum\Http\Middleware\ProcessIp->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
      #49 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(81): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
      #50 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(70): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\EmptyPipelineHandler))
      #51 /home/customer/www/myforum.com/public_html/forum/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(73): Laminas\Stratigility\MiddlewarePipe->handle(Object(Laminas\Diactoros\ServerRequest))
      #52 /home/customer/www/myforum.com/public_html/forum/vendor/flarum/core/src/Http/Server.php(45): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
      #53 /home/customer/www/myforum.com/public_html/forum/index.php(26): Flarum\Http\Server->listen()
      #54 {main} 

      Here's my forum info:

      Flarum core: 1.8.9
      PHP version: 8.4.1
      MySQL version: 8.0.39-30
      Loaded extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, enchant, json, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, intl, SPL, mbstring, session, standard, mysqlnd, mysqli, pcntl, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, random, readline, Reflection, exif, shmop, SimpleXML, soap, sockets, sodium, sysvmsg, sysvsem, tidy, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, memcached, Zend OPcache
      +-------------------------------------------+---------+--------+
      | Flarum Extensions                         |         |        |
      +-------------------------------------------+---------+--------+
      | ID                                        | Version | Commit |
      +-------------------------------------------+---------+--------+
      | flarum-flags                              | v1.8.2  |        |
      | flarum-approval                           | v1.8.2  |        |
      | flarum-tags                               | v1.8.3  |        |
      | flarum-suspend                            | v1.8.4  |        |
      | flarum-bbcode                             | v1.8.0  |        |
      | fof-pages                                 | 1.0.8   |        |
      | fof-byobu                                 | 1.3.9   |        |
      | flarum-mentions                           | v1.8.5  |        |
      | flarum-subscriptions                      | v1.8.1  |        |
      | afrux-forum-widgets-core                  | v0.1.7  |        |
      | flamarkt-backoffice                       | 0.1.4   |        |
      | flarum-markdown                           | v1.8.1  |        |
      | zerosonesfun-inline-audio                 | 3.0     |        |
      | v17development-seo                        | v2.0.5  |        |
      | sycho-move-posts                          | v0.1.8  |        |
      | rob006-last-post-avatar                   | 1.2.4   |        |
      | kilowhat-rich-embeds                      | 1.3.1   |        |
      | fof-user-directory                        | 1.3.3   |        |
      | fof-user-bio                              | 1.4.2   |        |
      | fof-upload                                | 1.7.0   |        |
      | fof-sitemap                               | 2.2.1   |        |
      | fof-polls                                 | 2.2.11  |        |
      | fof-nightmode                             | 1.6.0   |        |
      | fof-merge-discussions                     | 1.4.1   |        |
      | fof-links                                 | 1.3.0   |        |
      | fof-ignore-users                          | 1.2.1   |        |
      | fof-forum-statistics-widget               | 1.2.1   |        |
      | fof-formatting                            | 1.0.3   |        |
      | fof-follow-tags                           | 1.2.7   |        |
      | fof-ban-ips                               | 1.1.2   |        |
      | fof-anti-spam                             | 1.1.2   |        |
      | flarum-sticky                             | v1.8.2  |        |
      | flarum-statistics                         | v1.8.1  |        |
      | flarum-pusher                             | v1.8.1  |        |
      | flarum-nicknames                          | v1.8.2  |        |
      | flarum-lock                               | v1.8.2  |        |
      | flarum-likes                              | v1.8.1  |        |
      | flarum-lang-english                       | v1.8.0  |        |
      | flarum-emoji                              | v1.8.1  |        |
      | ekumanov-online-users-widget              | v1.0.7  |        |
      | davwheat-session-keepalive                | 1.1.0   |        |
      | clarkwinkelmann-selective-mediaembed      | 1.0.1   |        |
      | clarkwinkelmann-post-stream-search        | 1.1.0   |        |
      | clarkwinkelmann-advanced-search-highlight | 1.0.2   |        |
      | blomstra-turnstile                        | 0.1.6   |        |
      | blomstra-spam-prevention                  | 1.8.0   |        |
      | blomstra-mark-unread                      | 0.2.0   |        |
      | blomstra-database-queue                   | 1.1.0   |        |
      | askvortsov-rich-text                      | v2.1.7  |        |
      | askvortsov-pwa                            | v3.4.1  |        |
      | askvortsov-markdown-tables                | v1.2.1  |        |
      +-------------------------------------------+---------+--------+
      Base URL: https://myforum.com/forum
      Installation path: /home/customer/www/myforum.com/public_html/forum
      Queue driver: database
      Session driver: file
      Scheduler status: Active
      Mail driver: smtp
      Debug mode: off

      Here's what testing the file in the extension settings produces:

      I think I see what the issue is. The logic for determining MIME type is:

                  $type = $this->getMimeInternally();
      
                  // If mime_content_type returns application/zip or empty, perform magic byte detection
                  if ($type === 'application/zip' || empty($type)) {
                      return $this->detectUsingMagicBytes();
                  }

      If I try to upload a zip file, which is detected by getMimeInternally() as application/zip based on its extension, it then goes into the magic byte detection logic:

      private function detectUsingMagicBytes(): ?string
          {
              $handle = fopen($this->filePath, 'rb');
              if (!$handle) {
                  return null;
              }
      
              $magicBytes = fread($handle, 4); // Read the first 4 bytes
              fclose($handle);
      
              foreach ($this->getMappings() as $mapping) {
                  foreach ($mapping['magicBytes'] as $bytes) {
                      if ($magicBytes === $bytes) {
                          // Additional checks for APK-specific files
                          if ($mapping['extension'] === 'apk' && !$this->isApk($this->filePath)) {
                              continue; // Not an APK, fallback to other mappings
                          }
      
                          return $mapping['mime'];
                      }
                  }
              }
      
              return null;
          }

      However, the mapping file is missing, so the method cannot find a suitable mapping for the zip file (my file starts with PK04x03x which is standard for zip files) and returns null which leads to the exception I posted and ultimately an inability to upload.

      In any case, it would be good to have a fail-safe against null, something like this:

                  $type = $this->getMimeInternally();
      
                  // If mime_content_type returns application/zip or empty, perform magic byte detection
                  if ($type === 'application/zip' || empty($type)) {
                      $magicBytesType = $this->detectUsingMagicBytes();
                      if ($magicBytesType) {
                          return $magicBytesType;
                      }
                  }
      
                  return $type;

      The mappings between the magic bytes and the MIME type are expected to be in a file fof-upload.mime-mappings but I can't find such a file. I checked that the above is a recent development by @IanM (I guess you're imorland?), is it possible that you forgot to include that file?

      I recently moved my Flarum to a new server and copied over all the files and config and it seems to work fine, except that people can't upload files anymore. It only says "oops, something went wrong..." and there seem to be no useful errors in the server side logs either.

      I already double-checked file permissions etc. and it seems all fine.

      The files uploaded previously on the old server also work fine.

      Any idea how I could debug this?

        poVoq can you try uploading a file while debug mode is enabled? Also have the browser developer tools opened on the network tab to see the requests being made and their response.

        A likely issue would be that the webserver cannot write to the folder on the disk where uploads are stored.

        I found the error in the /storage/logs which I had forgotten about 😢

        I simply didn't have php-gd installed. But thanks for the help.

        Hey Guys. I seem to be having an issue porting form Vanilla to Flarum and the attachments and uploads. Can someone explain how your table structure works so that I can manually add a attachment to a post form an old location? I did use the nitro-porter project by Linc on GitHub. All my attachments are showing in the fof_upload_files table and there is a post number at the very end of the row but if I go to that post, nothing is there.

        I did a test upload using your tool and I do see that when it uploads a file, it creates an entry in the fof_upload_files table, it then creates a row in the fof_upload_file_posts table to associate the upload id with the post id and then there seems to be added to the post a long string that looks like this: [upl-image-preview uuid=ebd0eafb-8335-4f46-b3db-2723ccaf07d3 url=https://domain.com/assets/files/2024-12-31/1735616935-268987-img-20181127-155639-193-copy.jpg alt={TEXT?}]

        Does all of these items need to exist for an attachment to show up in a post? Why is there a post_id column in the fof_upload_files and also a table for fof_upload_file_posts which seems redundant? Is one old and will be deprecated?

        Any help would be appreciated to figure out why my attachments are not showing up!

          MrCaspan the additional posts table is for when you use your personal upload gallery to attach an already uploaded file to another post. The reason the post column exists on the shortest table is to keep track of uploads that no longer have a visible post (and thus can be removed from the filesystem).

          The reason your file isn't showing is probably because the bbcode isn't in the post content or it is malformed.

            luceos Ahh okay so the attachment doe snot show under the post or are just added to the end of a post when its associated with it (IE Like in a email) it actually needs to have bbcode added inline to the post. Okay Ill speak with Linc and see if we can get the Nitro-Porter updated to support this feature! Thank you for explaining the table structure and logic. That helps a lot

            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?

            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!

              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.