20

I don't know if this should be on here or on a different SE site.

I am working on a program, and to check for updates it downloads a file using URLDownloadToFile(). The file contains a number indicating the most recent version, and it is compared to a hard-coded value in the program (changing with each new version). So I've tried a few file-hosting sites.

MediaFire: The link takes you to a MediaFire page, and if you copy the address associated with the download button it takes you to the same page again (and somehow downloads the file without the user seeing any filenames).

Dropbox: The same problem occurs - there is no direct download link.

Google Drive: There is a download link, however URLDownloadToFile() does not accept it and nothing is downloaded.

Does anyone know of a file-hosting site that:

  • Is free
  • Has a direct download link
  • Can modify files (I don't mind if the URL changes as I can use the tiny.cc shortener which allows you to edit target URLs)

2 Answers2

30

Using dropbox you can change the http://www.dropbox.com to http://dl.dropboxusercontent.com and you get the direct download link.

Community
  • 1
  • 1
1

I really don't see why Google Drive won't work for your purpose.

As is already suggested by many people, you can simply create this link: https://docs.google.com/uc?export=download&id=FileID where FileID is the unique ID you can easily see in the sharing link (or you can get yourself an API key and run a little script to get all the metadata for your shared files if you want)

Yibo Yang
  • 2,353
  • 4
  • 27
  • 40
  • 1
    Google Drive will fail if the download reaches a particular limit saying `Usage Quota Exceeded`. You cannot use it in production. – Gowtham May 30 '15 at 05:37
  • Also, if the file is over 25Mb, a direct download link will redirect to an annoying page that says "file too big to scan for virus, please confirm download". You can supply a confirmation nonce, but it expires after 24 hours. – adapt-dev Feb 02 '16 at 18:16
  • True, I don't see an easy solution to that. But I've been able to get around the bandwidth quota (@Gowtham) by having multiple copies of the same files available with fallback links – Yibo Yang Feb 02 '16 at 18:24
  • 5
    Google Drive redirects to a temporary url and then downloads. The `https://docs.google.com/uc?export=download&id=FileID` link is a dynamic link. URLDownloadToFile() does not follow redirects. – 54 69 6D Mar 15 '16 at 19:49
  • 2
    I believe they have deprecated it few years ago. – Nakilon Mar 24 '20 at 15:05