Get size of file behind download link
The new website I'm building has a section for the company newsletter and on a sub-page, a newsletter archive which spans back to The newsletters are displayed in a table ignore the names, they're in the process of being renamed along with the type of file and the size. This list is auto-generated from a folder on the server and users may be browsing the site on their mobile phone. Some people are saying that the file size and type shouldn't be shown because we live in the age of high speed internet and more-than-capable devices.
I'm happy to ditch the type column because all the files are PDF, but the file sizes vary from 44kb to 9mb, and I feel it's good UX to show the user the size so they can know how long they'd need to wait if their device decides to open rather than download the file, and if the amount of data it would require would fit their current usage limits in Australia, some phone plans have mb of data unless you pay extra.
It is always important to show the filetype. Users are apprehensive about downloading unknown files EXE files etc. I'd much prefer a one-line summary of the contents of each newsletter, or at least a title, compared to type of file. To show file size, you could display sizes just next to the name and only in cases where the file sizes are larger than a certain threshold, such as 2 or 4 MB.
Sign up to join this community. The best answers are voted up and rise to the top. Zou 1 1 gold badge 4 4 silver badges 9 9 bronze badges. Add a comment. Active Oldest Votes. Use the -L flag to follow symbolic links. Improve this answer. DopeGhoti DopeGhoti Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. I was wondering if there was a way to use jQuery to find out the file size for a PDF that i'm linking to a webpage. I want to make it so that on hovering over the download link, a modal box pops up saying the file size of the PDF. I can do the second bit, the only thing i'd like to know is how to find out the file size. I dont know if jQuery is capable of this.
If not then too bad i guess.. I feel like this is too much to be doing client-side, but I don't know the details of your application, so presuming you have to do it with jQuery Earlier I recommended the jqHead plugin, but after I tried to use it I found that it was broken.
Here is working snippet to find the file size in javascript without going to the server, if you are about to upload the file to the server. If you know the file size beforehand, you can put that in the title attribute of the download link.
You can also use jQuery to show a custom popup. The only way that I can think of to do this would be to create a web service that would return you the filesize of the PDF. In the answer above, Chrome 21 and Safari 6 did not have a fileSize member, but does have size. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. This is definitely a very useful tool.
If you find a similar add-on for fire-fox like Nicky requested above, let us know. Thats a neat add-on for IE but I guess we should get more if we search for it. When sending header and getting response, it may be able to time response but without downloading the file or take a predefined speed rate , it is impossible to measure download time, or it could be pretty inaccurate. For FF user, download statusbar is an option, but it shows information in the status bar while downloading the file. I am sure you will found something useful.
For example: I have 20 Rapidshare. Your email address will not be published. July 4,
0コメント