got it, just look in the javascript console duh
apparently the form name went away and was replaced by an ID so the javascript that changes the form enctype wasn't working
so in Attachments.php change
document.frmPostComment.enctype = 'multipart/form-data';
to
var f = document.getElementById('frmPostComment');
f.enctype = 'multipart/form-data';
AND
document.frmPostDiscussion.enctype = 'multipart/form-data';
to
var f = document.getElementById('frmPostDiscussion');
f.enctype = 'multipart/form-data';
working great now, sweet
when I try to create a new discussion and I don't put a topic in the textfield usually i get a warning, but when a attachment is selected i get the follwing error:
Trying to get property of non-object in \htdocs\v\extensions\Attachments\default.php on line 303
Ok, I've just released an official Vanilla 1 version of the attachment extension. You can find it on the Addons page. If you find any bugs or have any suggestions, let me know. Btw, I'm already working on the displaying of uploaded images...
I found a bug: i can't upload a file called TEST.JPG because it's JPG and not jpg i also wasn't able to upload a ZIP because Firefox sent a 'application/download' and not a 'application/zip', when I add application/download in the settings it works.
Another bug: if i have added an attachment, the next time i click on the discussion, vanilla goes to the bottom of the first page, and not to the last message
edit: now it works well, hm... maybe it's my fault
for those who can't wait [like me ], here's a quick hack to enable immediate image display. in Attachments/default.php, look for the GetAttachmentsString function. change the first few lines of the foreach loop from this:
foreach( $files as $file ) {
$filename = substr(strstr(basename($file), "."), 1);
$s .= "<li id=\"".$CommentID."_".$filename."\"><a href=\"".GetUrl($Context->Configuration, 'comments.php') . "?CommentID=" .$CommentID. "&Download=" .urlencode($filename). "\">". $filename ."</a>";
of course an image will probably look weird inside a <ul>, but i took the ul (and the attachments div) out of my own version and just list the files with linebreaks.
I use a modified extension on my WoW site already: www.wow-myst.com. It's still Vanilla 0.9.3, and I had to change a lot of stuff manually because it doesn't have the delegate class. Maybe I have to time to work on it this weekend
Comments
when I try to create a new discussion and I don't put a topic in the textfield usually i get a warning, but when a attachment is selected i get the follwing error:
Trying to get property of non-object in
jazzman, now that's an even more useful usage scenario :-)
i can't upload a file called TEST.JPG because it's JPG and not jpg
i also wasn't able to upload a ZIP because Firefox sent a 'application/download' and not a 'application/zip', when I add application/download in the settings it works.
edit: now it works well, hm... maybe it's my fault
in Attachments/default.php, look for the GetAttachmentsString function.
change the first few lines of the foreach loop from this:
foreach( $files as $file ) { $filename = substr(strstr(basename($file), "."), 1); $s .= "<li id=\"".$CommentID."_".$filename."\"><a href=\"".GetUrl($Context->Configuration, 'comments.php') . "?CommentID=" .$CommentID. "&Download=" .urlencode($filename). "\">". $filename ."</a>";
to this:
foreach( $files as $file ) { $filename = substr(strstr(basename($file), "."), 1); if(in_array(strtolower(substr($filename,-3,3)),array('gif','jpg','png'))) { $absfilename = $Context->Configuration['APPLICATION_PATH'] . "uploads/{$CommentID}.{$filename}"; $relfilename = $Context->Configuration['WEB_ROOT'] . "uploads/{$CommentID}.{$filename}"; $size = (list($width, $height, $type, $attr) = getimagesize($absfilename)) ? "style=\"width:{$width}px; height:{$height}px; border:0\" " : ""; $s .= "<li id=\"".$CommentID."_".$filename."\"><img src=\"$relfilename\" $size/><br />\n"; } else { $s .= "<li id=\"".$CommentID."_".$filename."\"><a href=\"".GetUrl($Context->Configuration, 'comments.php') . "?CommentID=" .$CommentID. "&Download=" .urlencode($filename). "\">". $filename ."</a></li>\n"; }
just a quick hack, like i said.
of course an image will probably look weird inside a <ul>, but i took the ul (and the attachments div) out of my own version and just list the files with linebreaks.