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
This discussion is related to the fileupload addon.
This discussion has been closed.
Comments
Vanilla Forums COO [GitHub, Twitter, About.me]
Vanilla Forums COO [GitHub, Twitter, About.me]
{"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
http://gist.github.com/583098
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!
'DateInserted' => 'NOW()',
scratch that, not working
Attachments
<?php
foreach ($this->CommentMediaList as $Media) {
if (strpos($Media->Type, 'image/') !== FALSE) {
?>
<?php
} else {
?>
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.
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.
Thank You
http://lista.bolsafinanceira.com/FileUpload-1.1patched.tar.gz
This plugin is compatible with vanilla version 2.0.6 .. etc etc.