Getting a file size from a URL (PDF) link

Is there a way to do this in ColdFusion?

Page 1 of 1

3 Replies - 2021 Views - Last Post: 12 October 2010 - 01:54 PM Rate Topic: -----

#1 Nyarlathotep333  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 07-February 08

Getting a file size from a URL (PDF) link

Posted 11 October 2010 - 06:18 PM

OK, I've been trying to find a way to generate a file size from a PDF file that exists on a different server via a URL. I know there are various ways of doing this if the PDF file is in a local directory (cfdirectory or cffile seem to be able to do this easily enough) but is it possible to generate a file size from the URL link of the PDF file?

Any insight is appreciated. Thanks!
Is This A Good Question/Topic? 0
  • +

Replies To: Getting a file size from a URL (PDF) link

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1591
  • View blog
  • Posts: 3,015
  • Joined: 13-January 08

Re: Getting a file size from a URL (PDF) link

Posted 11 October 2010 - 06:45 PM

I think any solution will require you to at least start the download. Insofar as a solely CF solution goes I believe you'd need to download the entire file first and then see how large it is.

I know there are some downloaders that can get the total filesize as the download starts (so they can update a percentage status bar).
Was This Post Helpful? 0
  • +
  • -

#3 xheartonfire43x  Icon User is offline

  • D.I.C Regular

Reputation: 46
  • View blog
  • Posts: 454
  • Joined: 22-December 08

Re: Getting a file size from a URL (PDF) link

Posted 11 October 2010 - 06:55 PM

If you wanted just CF to do it, then you would have to use the CFHTTP tag to download the file and then to a fileRead() on it. If you have access to the server and it runs CF (or any other programming language that can do similar to a fileRead()) you could create a script that when passed the file path it returns the filesize. If the file server is running Linux you could run node.js which has some pretty simple file system functions that you could use.
Was This Post Helpful? 1
  • +
  • -

#4 Nyarlathotep333  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 07-February 08

Re: Getting a file size from a URL (PDF) link

Posted 12 October 2010 - 01:54 PM

Awesome! Thanks!

I'm not sure what the server is running, but this points me in the right direction with the right questions to ask the guys who maintain that.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1