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.
[File Upload] Uploaded Files on anything except first comment disappear?
I have the plugin configured correctly, and it worked before, but now, all of a sudden, it stopped working. It uploads okay, but the attachments don't show up. Does anyone know what the deal with that is? Take http://theocas.net/discuss/index.php?p=/discussion/5/attempt-at-sucess/#Item_6 for example. I tried re-installing the plugin, but I simply can not figure it out.
Also, I can clearly see that the files get uploaded onto the server, but they don't seem to want to display.
Also, I can clearly see that the files get uploaded onto the server, but they don't seem to want to display.
0
Comments
Edit: I have taken a screenshot of the GDN_Media table from within PHPMyAdmin:
Edit 2: I've completely disabled the plugin, deleted GDN_Media, and re-enabled the plugin, but even now when adding an image to a comment, it won't work, but adding it to a new topic works fine.
I've also noticed that user permissions aren't respected. It seems like, when File Upload is enabled, ALL users (regardless of settings) can see and post attachments.
The files were there, with correct names and stuff, and the entries were in the DB, as it can be seen that I tried to upload the same file multiple times.
This is an awesome plugin, and I really want this issue solved. The bug did not appear until after I uploaded 3 files for strange reasons. Or maybe just 'cause I had a 6th topic being added, or leaving my Vanilla forum alone for 3 days.
I tried adding in the linking keys ("comment" and the comment ID) on an uploaded file, and it does appear against the comment as you would expect. However, this leads on to the next issue: the file cannot be downloaded. Clicking on it just gives a blank page. Clicking on the files attached to the top discussion comment downloads those files okay.
@theocas I also uploaded three files okay, and it as the fourth that is failing to link. I don't know if that is a coincidence?
Actually - it looks like it could be a timing issue. The files are uploaded using AJAX and the upload IDs of the files are returned to the comment form. When the form is submitted, the comment is created and then the media with the relevant IDs is attached (aside: need to check hackers can't take ownership of media files by manipulating the IDs in comments). If the comment is submitted before the AJAX upload returns, then the ID never gets into the comment and so the uploaded file is left hanging without being attached to anything. You can confirm this by uploading a large file and clicking on "Post Comment" as quickly as possible, before the upload completes, then you will see the effect. Check out the NULLs in the Media table where the file should be linked to the comment.
Workaround for this is to tell users to wait for the upload to complete before submitting, or turn off AJAX. Fix would be to prevent a comment being saved, or fall back to non-AJAX upload if the comment is submitted before the AJAX uploads are complete.
The settings screen gives me permissions problems if I try to go into it. I wonder if the permissions error has something to do with the above problem?
Your issue with submitting posts before the upload completed is excellent suggestion - but the files users usually upload are images, 2 MB max, so it is uploaded in seconds.
Maybe disable the Post Comment button until the file finished sending, or do it in a inline pop-up?
Huh... anyone figure this one out? I just upgraded to 2.0.9 to get this baby running... and images are in limbo, I guess... ?
My files are getting uploaded, its just that the comment does not seem to get the link...
http://lista.bolsafinanceira.com/FileUpload-1.1patched.tar.gz
The files attached to the top of the discussion very consistently appear when editing any comment. An example can be seen here:
http://www.consil.co.uk/downloads/Test-File-Updloads-Localfood.png
The file was attached to the discussion. A comment was then added. The comment was then edited, and like magic - the discussion file edit form appears with the comment edit form.
If I create a comment with its own attachment, and then edit that comment, the comment's own attachment appears below the "save" and "cancel" buttons, while the uploaded file for the head of the discussion appears above the "save" and "cancel" buttons.
Edit: without going into any depth, the problem seems to come from the PostController_BeforeFormButtons_Handler() method. This calls up DrawAttachFile() but sets the "Type" of sender to "Discussion" inappropriately. The DrawAttachFile() function then treats the rendered comment as a discussion and calls up the attachment rendering that is attached to the discussion. Or something like that. There is definitely a problem in this area - maybe too many events or context for the events not set correctly.