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.

FileUpload 1.1 Released

135

Comments

  • TimTim Vanilla Staff
    I'm aware of this problem and will be fixing it as soon as I have time.

    Vanilla Forums COO [GitHub, Twitter, About.me]

  • I'm aware of this problem and will be fixing it as soon as I have time.
    Yay. But do you know what the cause of this may be? Possibly wrong ID's for comments?
  • TimTim Vanilla Staff
    edited September 2010
    No idea

    Vanilla Forums COO [GitHub, Twitter, About.me]

  • vanilla 2.0.9, fileUpload 1.1, can't get it to work, it posts and saves file but that what's coming in response:

    {"MediaResponse":{"Status":"success","MediaID":false,"Filename":"27511_540.jpg","Filesize":28005,"FormatFilesize":"27.3K","ProgressKey":""},"FormSaved":true,"DeliveryType":"VIEW","Data":"","StatusMessage":"","RedirectUrl":""}

    why MediaID false? obviously it fails to save to db
  • I fixed a bug for IE. it has to deal with the dynamic creation of the form tag which resulted in IE not sending the file. Just replace Gdn_MultiFileUpload.prototype.NewUploader in fileupload.js with this:
    http://gist.github.com/583098
  • edited September 2010
    Hey Vanilla community,

    spent three hours digging in Vanilla and FileUploader and finally got a solution for attachments not attaching.

    So we have Media table, and have DateInserted field with data type "datetime", also we got pretty cool core Validation, and there's a lot of default validation rules which apply on data type. According to default datetime rule "Dates should be in YYYY-MM-DD or YYYY-MM-DD HH:MM:SS format", and DateInserted is unix timestamp. So validation fails and nothing is put in DB.

    The fix is really quick and easy:
    /plugins/FileUpload/class.fileupload.plugin.php

    find the line:

    'DateInserted' => time(),

    and replace it with

    'DateInserted' => strftime('%Y-%m-%d %H:%M:%S', time()),

    and that should do the trick.

    Vanilla2 is great stuff but documentation sucks hard. Reverse engineering someone's code is fun but it's HUGE time killer as well.

    Cheers!
  • ithcyithcy New
    edited September 2010
    good catch... should probably just use mysql's NOW() keyword instead.
    'DateInserted' => 'NOW()',


    scratch that, not working
  • Validation comes BEFORE translation into SQL ;)
  • wow, you're quick :)
  • meh. the validator should really accept... valid keywords, but anyway.
  • ithcyithcy New
    edited September 2010
    if anyone wants to actually display the uploaded images along with the comments, instead of just presenting download links, you can replace plugins/FileUpload/views/link_files.php with this:
    Attachments

    <?php
    foreach ($this->CommentMediaList as $Media) {
    if (strpos($Media->Type, 'image/') !== FALSE) {
    ?>

    imagePath; ?>"/>

    <?php
    } else {
    ?>

    imageGetWebResource('images/gear.png'); ?>"/>
    MediaID}/{$Media->Name}"); ?>"><?php echo $Media->Name; ?> (<?php echo Gdn_Format::Bytes($Media->Size, 0); ?>) <?php } } ?>

    Just tweak the HTML and your theme to your liking. I got rid of the whole "Attachments" heading in mine.
  • No, not even with the above changes, it still won't work on comments :<
  • I keep getting a the file uploaded was too big error. It is well below the 10 M requirement. Anyone else having this issue???
  • edited September 2010
    i can upload files but they aint showing up in comments.. why? vanilla 2.0.6 (with signature plugin)
  • well they show up when i create a new post but when i add a comment to a post they aint showing up.
  • edited September 2010
    Okay! I got it working now. Change this in file class.fileupload.plugin.php, around line 139-141.

    if ($Comments) while ($Comment = $Comments->NextRow()) $CommentIDList[] = $Comment->CommentID;
    to
    if ($Comments) foreach ($Comments->Result() as $Comment) $CommentIDList[] = $Comment->CommentID;

    Please fix this in the release.
  • not showing up in comments (2.0.9)
  • I did some changes in plugin and it worked well at current version of Vanilla (2.0.9).

    http://lista.bolsafinanceira.com/FileUpload-1.1patched.tar.gz
  • Also bear in mind that when someone develops a plugin for Version X, and you upgrade to Version Y, it is still the plugin developer's responsibility to maintain that functionality... not ours.

    I've seen a few comments that seem to imply that the community expects core support for plugin features when upgrading. While this would be nice, its not entirely feasible.
    Also bear in mind that when someone develops a plugin for Version X, and you upgrade to Version Y, it is still the plugin developer's responsibility to maintain that functionality... not ours.

    I've seen a few comments that seem to imply that the community expects core support for plugin features when upgrading. While this would be nice, its not entirely feasible.
    there should be a way for users to express rather CoolOldPlugin works with 2.0.9, and this should be displayed on the plugin information page.

    This plugin is compatible with vanilla version 2.0.6 .. etc etc.
This discussion has been closed.