Attachments File Size [Fixed]
Printed from: Snitz™ .NET Core
URL: https://www.reddick.co.uk/mvc/Topic/Posts/4922?pagenum=1
Printed on: Jul 05, 2025 17:39
Topic
Author : philsbbs
Subject : Attachments File Size [Fixed]
Posted : Jan 01, 2019 14:59
Message :
Chrome 71 64bit Windows 10 Pro latest buildSummary
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=0Results
Expected result --------------- Attached to show file size next to file name Actual result --------------- see : http://midland.philsbbs.com/Topic/Posts/8957?pagenum=1&archived=0Notes/Attachments
http://midland.philsbbs.com/Topic/Posts/8957?pagenum=1&archived=0 Example
Replies ...
1
Reply Author: HuwR
Replied on: 1/1/2019 3:37:18 PM..ToLocalTime().ToForumDisplay()
Message:
looks to be related to the file type, works ok on a csv/zip file will do some tests find out why
2
Reply Author: philsbbs
Replied on: 1/1/2019 3:55:15 PM..ToLocalTime().ToForumDisplay()
Message:
ok mate.
3
Reply Author: HuwR
Replied on: 1/1/2019 4:05:25 PM..ToLocalTime().ToForumDisplay()
Message:
actually, it works for me, maybe browser related, are you using chrome ?
4
Reply Author: philsbbs
Replied on: 1/1/2019 4:33:59 PM..ToLocalTime().ToForumDisplay()
Message:
yep chrome v71
5
Reply Author: philsbbs
Replied on: 1/1/2019 4:46:22 PM..ToLocalTime().ToForumDisplay()
Message:
http://www.reddick.co.uk/Mvc/Topic/Posts/4923?pagenum=-1#16287 displays file size ok and thats in chrome v71
6
Reply Author: HuwR
Replied on: 1/2/2019 6:19:30 PM..ToLocalTime().ToForumDisplay()
Message:
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
7
Reply Author: philsbbs
Replied on: 1/2/2019 10:12:01 PM..ToLocalTime().ToForumDisplay()
Message:
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.
8
Reply Author: HuwR
Replied on: 1/3/2019 2:57:01 PM..ToLocalTime().ToForumDisplay()
Message:
must be you then
as you can see from my screenshot zip/xml/xlsx all worked (that was on your site using chrome)
9
Reply Author: philsbbs
Replied on: 1/12/2019 9:29:24 PM..ToLocalTime().ToForumDisplay()
Message:
http://midland.philsbbs.com/Topic/Posts/8960?pagenum=-1 still have the issue @huwr
10
Reply Author: HuwR
Replied on: 1/13/2019 8:16:46 AM..ToLocalTime().ToForumDisplay()
Message:
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
11
Reply Author: philsbbs
Replied on: 2/3/2019 8:01:23 PM..ToLocalTime().ToForumDisplay()
Message:
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.
12
Reply Author: HuwR
Replied on: 2/4/2019 1:30:39 PM..ToLocalTime().ToForumDisplay()
Message:
Well spotted, will fix on my return from sunny Miami
13
Reply Author: philsbbs
Replied on: 2/5/2019 10:56:51 PM..ToLocalTime().ToForumDisplay()
Message:
no rush you can stay out there a few more weeks (not months lol)
14
Reply Author: HuwR
Replied on: 2/7/2019 9:05:12 PM..ToLocalTime().ToForumDisplay()
Message:
Not sure I can cope with the weather back home, 26 and sunny here
15
Reply Author: philsbbs
Replied on: 2/10/2019 11:17:58 AM..ToLocalTime().ToForumDisplay()
Message:
rain here in croydon, UK
16
Reply Author: HuwR
Replied on: 2/10/2019 11:27:58 AM..ToLocalTime().ToForumDisplay()
Message:
Raining in Tampa this morning, but still mid twenties.
17
Reply Author: Torborg
Replied on: 2/11/2019 8:51:53 AM..ToLocalTime().ToForumDisplay()
Message:
A lot of rain here in the weekend too and some of the snow melted. Sunny and cold today.
18
Reply Author: HuwR
Replied on: 2/17/2019 1:37:47 PM..ToLocalTime().ToForumDisplay()
Message:
Fixed here
19
Reply Author: HuwR
Replied on: 2/17/2019 1:44:54 PM..ToLocalTime().ToForumDisplay()
Message:
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]"); }
20
Reply Author: philsbbs
Replied on: 2/18/2019 1:42:20 AM..ToLocalTime().ToForumDisplay()
Message:
Thank you @huwr change applied.