Attachments File Size [Fixed]

Snitz™ .NET Core
https://www.reddick.co.uk/mvc/Topic/Posts/4922?pagenum=1
Jul 05, 2025 17:39

Topic


philsbbs
Attachments File Size [Fixed]
Jan 01, 2019 14:59


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


HuwR
1/1/2019 3:37:18 PM..ToLocalTime().ToForumDisplay()


looks to be related to the file type, works ok on a csv/zip file will do some tests find out why
philsbbs
1/1/2019 3:55:15 PM..ToLocalTime().ToForumDisplay()


ok mate.
HuwR
1/1/2019 4:05:25 PM..ToLocalTime().ToForumDisplay()


actually, it works for me, maybe browser related, are you using chrome ?
philsbbs
1/1/2019 4:33:59 PM..ToLocalTime().ToForumDisplay()


yep chrome v71
philsbbs
1/1/2019 4:46:22 PM..ToLocalTime().ToForumDisplay()


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


displays file size ok and thats in chrome v71
HuwR
1/2/2019 6:19:30 PM..ToLocalTime().ToForumDisplay()


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/2/2019 10:12:01 PM..ToLocalTime().ToForumDisplay()


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/3/2019 2:57:01 PM..ToLocalTime().ToForumDisplay()


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/12/2019 9:29:24 PM..ToLocalTime().ToForumDisplay()


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

still have the issue @huwr
HuwR
1/13/2019 8:16:46 AM..ToLocalTime().ToForumDisplay()


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
2/3/2019 8:01:23 PM..ToLocalTime().ToForumDisplay()


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
2/4/2019 1:30:39 PM..ToLocalTime().ToForumDisplay()


Well spotted, will fix on my return from sunny Miami smile
philsbbs
2/5/2019 10:56:51 PM..ToLocalTime().ToForumDisplay()


no rush you can stay out there a few more weeks (not months lol)
HuwR
2/7/2019 9:05:12 PM..ToLocalTime().ToForumDisplay()


Not sure I can cope with the weather back home, 26 and sunny here bigsmile
philsbbs
2/10/2019 11:17:58 AM..ToLocalTime().ToForumDisplay()


rain here in croydon, UK
HuwR
2/10/2019 11:27:58 AM..ToLocalTime().ToForumDisplay()


Raining in Tampa this morning, but still mid twenties.
Torborg
2/11/2019 8:51:53 AM..ToLocalTime().ToForumDisplay()


A lot of rain here in the weekend too and some of the snow melted. Sunny and cold today. smile
HuwR
2/17/2019 1:37:47 PM..ToLocalTime().ToForumDisplay()


Fixed here
HuwR
2/17/2019 1:44:54 PM..ToLocalTime().ToForumDisplay()


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]");
}
philsbbs
2/18/2019 1:42:20 AM..ToLocalTime().ToForumDisplay()


Thank you @huwr change applied. thumbsUp
© 2016-2025 Snitz™ Forums MVC