Attachments File Size [Fixed]

Snitz™ Forums .NET Core
https://www.reddick.co.uk/mvc/Topic/Posts/4922?pagenum=1
4/27/2024

Topic


philsbbs
Attachments File Size [Fixed]
1/1/2019


Chrome 71 64bit
Windows 10 Pro latest build

Summary
I don't get the file size showing on attachments.
Steps to reproduce error
See post on my forum

http://midland.philsbbs.com/Topic/Posts/8957?pagenum=1&archived=0
Results
Expected result
---------------

Attached to show file size next to file name

Actual result
---------------

see : http://midland.philsbbs.com/Topic/Posts/8957?pagenum=1&archived=0


Notes/Attachments
http://midland.philsbbs.com/Topic/Posts/8957?pagenum=1&archived=0

Example

 

Replies ...


philsbbs
2/18/2019


Thank you @huwr change applied. thumbsUp
HuwR
2/17/2019


The fix is just a change to a template so you may attempt the fix yourself if you wish.
Open Views\Shared\PostMessage.cshtml and look for the code below (should be arounf line 370)
Code:
                        if (arr[1].indexOf("pdf") >= 0) {
$("#" + textId).insertAtCaret("[pdf]" + arr[0].replace('"', '') + "[/pdf]");
} else if (arr[1].indexOf("image") >= 0) {
$("#" + textId).insertAtCaret("[img]" + arr[0].replace('"', '') + "[/img]");
} else {

$("#" + textId).insertAtCaret("[file]" + arr[0].replace('"', '') + "[/file]");
}

Change it as below (or replace block with code below)
Code:
                        var filesize = "";
if (arr[1].indexOf("pdf") >= 0) {
$("#" + textId).insertAtCaret("[pdf]" + arr[0].replace('"', '') + "[/pdf]");
} else if (arr[1].indexOf("image") >= 0) {
$("#" + textId).insertAtCaret("[img]" + arr[0].replace('"', '') + "[/img]");
} else {
if (arr.length === 3) {
filesize = arr[2].replace('"', '');
}
$("#" + textId).insertAtCaret("[file " + filesize + "]" + arr[0].replace('"', '') + "[/file]");
}
HuwR
2/17/2019


Fixed here
Torborg
2/11/2019


A lot of rain here in the weekend too and some of the snow melted. Sunny and cold today. smile
HuwR
2/10/2019


Raining in Tampa this morning, but still mid twenties.
philsbbs
2/10/2019


rain here in croydon, UK
HuwR
2/7/2019


Not sure I can cope with the weather back home, 26 and sunny here bigsmile
philsbbs
2/5/2019


no rush you can stay out there a few more weeks (not months lol)
HuwR
2/4/2019


Well spotted, will fix on my return from sunny Miami smile
philsbbs
2/3/2019


Believe found the issue



If I use the attach file as marked in the image it does not upload the file size.

But if I use the paperclip to attach a file to a post it shows the size.
HuwR
1/13/2019


I can't replicate the issue, it works fine for me tried in IE, Edge, FF and Chrome
Uploading a file results in this tag
philsbbs
1/12/2019


http://midland.philsbbs.com/Topic/Posts/8960?pagenum=-1

still have the issue @huwr
HuwR
1/3/2019


must be you then smile as you can see from my screenshot zip/xml/xlsx all worked (that was on your site using chrome)
philsbbs
1/2/2019


I know it not get the size for the old uploads and only gets the size when a new attachment is uploaded but

Testing further on my site and its seems to depend on the file extensions... Example below.

export_en.csv 92 KB

dbsnvarchar-fix.xml

MemberFields_1.0.zip

.xml and .zip did not get the file size when I added the attachments on my site. as you can see the csv worked ok.
HuwR
1/2/2019


Ok, it works fine for me in Chrome on your site too


So, a question, are you expecting it to display the size of a previously uploaded file? It will not do this, it only knows the size during the upload so the size is added to the tag when you upload the file it can not be done retrospectively with an older file tag
philsbbs
1/1/2019


http://www.reddick.co.uk/Mvc/Topic/Posts/4923?pagenum=-1#16287


displays file size ok and thats in chrome v71
philsbbs
1/1/2019


yep chrome v71
HuwR
1/1/2019


actually, it works for me, maybe browser related, are you using chrome ?
philsbbs
1/1/2019


ok mate.
HuwR
1/1/2019


looks to be related to the file type, works ok on a csv/zip file will do some tests find out why
© 2016-2024 Snitz™ Forums MVC