Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Post Attachments not showing
pinchies
New
Hi all, I'm having problems with attaching files to posts on my site.
- Uploading images works fine, and they display correctly.
- Attaching files are uploaded correctly, and I can see them on the server in the uploads folder.
- But, no attachment is visible in the post after submission.
- I have enabled the uploading permission for users.
- No error message is generated.
Any assistance/advice would be appreciated, I'm out of ideas on this one.
0
Comments
What kind of files are you trying to upload? You can add allowed extensions to you conf/config.php:
Also you are using both button bar and editor. You can disable button bar as it is superseded by the editor plugin.
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Thanks, I checked that I have enabled the file types I want. I have also disabled the button bar plugin, but the problem remains. Even when I upload any non-image type, I do not see any attachment below the post after submitting the post. Any other suggestions?
I did a bit of poking, and I checked my database, and the "Media" table is completely empty - so it seems the attachments are not being successfully saved into the database after uploading?
The other clue I have, is that in the permissions list, I only have upload, I don't have download visible in the list:
Apparently there is supposed to be two permissions?
https://blog.vanillaforums.com/product/how-to-use-file-upload
After spending hours debugging the ENTIRE system, I finally found the cause, and fixed it.
@pinchies
It is considered polite to provide the solution when you answer your own question, to help others in the future.
Cheers... I was planning to, just not at 3:30am...
PROBLEM:
The solution was a database table structure issue. For some reason I had “StorageMethod” as a mandatory column in the Media table.
SOLUTION:
Removing “StorageMethod” from the structure of table “Media” fixed the issue.
CAUSE
It seems at some point there was support for uploading files to Amazon S3, but this was pulled or removed at some point. I don’t know how my database structure ended stuffed, but now I am still wondering if there are other database issues with my install too.
Frustratingly, I couldn’t find any documentation about this. I couldn’t find an overview of the standard vanilla forum database layout, nor any overview of the vanilla forum system architecture.
I ended up wading through poorly documented code adding logging through classes and methods as they were called trying to trace the error. I started in the editor plugin, which took me to media classes, which took me to the main GDN model class, and eventually into the Validation class.
The error was occurring in the Validation class with the upload failing validation for lacking a required value for a “storageMethod” column, but no error was being logged or recorded anywhere that I could see.
Eventually I figured this out, tried to to bypass validation, and finally received a useful database insert error stating a missing value for StorageMethod.
I couldn’t find any info for “StorageMethod”, whether it was important or not - except for a few pages on google that suggested it was a removed feature that was no longer needed:
https://github.com/vanilla/porter/issues/75#issuecomment-126535979
From here I removed the StorageMethod column and the problem went away.
Thanks @Bleistivt for trying to give some useful suggestions. Unfortunately in this case the problem was much deeper.
Thanks for the detailed explanation.
You should run https://jgauroraforum.com/utility/structure if you have any concerns
Thank you - that is very useful, it found a few things I apparently need to change! Is there any kind of Troubleshooting FAQ page for Vanilla? That's exactly the kind of tip that should be listed!!
It is not in any trouble shooting faq that I know of. But it is part of the normal update process. There will be some messages that will keep on appearing on /utility/structure. Don't worry about them.
You're my hero, thank you for posting in detail!!
I had the same issue but did not see any errors in the log.
Using your hint I could solve the problem.
Thank you!
I'd like to note we moved to our self-hosting information over to our documentation site.
If you had over there and click the pencil you can make a pull request with any debugging tricks or tips you might have.
Personally I don't have much time to update it myself as I do most of my work locally or on Vanilla Cloud, but I'm happy to review any pull requests made.