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.
Options

[File Upload] Uploaded Files on anything except first comment disappear?

edited September 2010 in Vanilla 2.0 - 2.8
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.
Tagged:

Comments

  • Options
    edited September 2010
    Also, I have checked in the source code, and was unable to find any other references to Attachments, so the theme is not hiding them. I tried several themes, so I believe this is an issue with the plugin, or the Database itself.

    Edit: I have taken a screenshot of the GDN_Media table from within PHPMyAdmin:
    image
    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.
  • Options
    I've had the same problem. Only the first post shows attachments for me. I didn't even think to check if they were actually getting uploaded. I assumed they weren't.

    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.
  • Options
    I've had the same problem. Only the first post shows attachments for me. I didn't even think to check if they were actually getting uploaded. I assumed they weren't.

    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.
    Checking if the files were uploaded was actually the first thing I did, since my PHP install throws random parse errors, at random times. Seems to be a a PHP issue though.
    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.
  • Options
    judgejjudgej
    edited September 2010
    Same problem here. The files are getting uploaded and the details are being added to the media table, but the record in the media table is not getting linked back to the comment that the files are supposed to be attached to.

    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.
  • Options
    judgejjudgej
    edited September 2010
    Also, editing a discussion with attachments, and the attachments do not show up, though adding multiple files to a discussion head is cumulative. I am assuming the uploads should show when editing the discussion head so that they can be deleted if required?

    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?
  • Options
    Also, editing a discussion with attachments, and the attachments do not show up, though adding multiple files to a discussion head is cumulative. I am assuming the uploads should show when editing the discussion head so that they can be deleted if required?

    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?
    Hmm, when I edit I can not see the attachments in my latest tests, but it might have worked at one point.

    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?
  • Options
    moensmoens New
    edited September 2010
    Edit to mention the fixes are in this thread: http://vanillaforums.org/discussion/12782/fileupload-1.1-released

    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...
  • Options
    edited September 2010
    If anyone wants to try my changes to 2.0.9:

    http://lista.bolsafinanceira.com/FileUpload-1.1patched.tar.gz
  • Options
    @ruifelipe, you're awesome. I thought I was going to have to go hunt down the issue myself. Whatever you did absolutely needs to be pulled into the main branch.
  • Options
    edited September 2010
    Plugin is not usable, permissions not working, when attach delete whit post file not deleted from host.
  • Options
    judgejjudgej
    edited November 2010
    @theocas I'm using vanilla 2.0.13 now and FileUpload 1.2.1 (or is that 1.2.0?)

    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.
  • Options
    It all seemed to fix itself with the latest version. Very unusual.
Sign In or Register to comment.