Update [10/2/2016]: It appears that Google has finally put a stop to this trick.
Update [11/7/2016]: Looks like Jonathan in the comments has figured a new way to do it!
Update [2/7/2017]: The website http://gdurl.com works too!
Imagine you want to use a QR code so guests at Parents’ Night can scan the code and stream video or audio straight to their mobile device. If you share the files in Google Drive, users will be taken to a Google page where they have to download the file first. But if you can create a link that points directly to the file, users can access the content right in their mobile browser.
Turns out you can do this while still using Google Drive. Any public folder in Drive can host files and provide direct links to the files.
How to create the hosting URL:
https://googledrive.com/host/FolderID
This will provide a folder that will give direct links to files inside the folder.
Note: hosting view will not display files created in Google Docs.
Example:
- https://googledrive.com/host/0B42c3pO5_y67X0Fhcmg5XzhoR0U
(Google hosting view) - https://drive.google.com/folderview?id=0B42c3pO5_y67X0Fhcmg5XzhoR0U&usp=sharing
(Google Drive View)
Once in the hosting folder, you can right click on any of the files to get a direct link to the file.
Is this still working for you, Dale? I’m receiving a 404 error when I try to append the folder ID to the URL.
Answered my own question. The folder needs to be shared publicly on the web, otherwise the folder won’t work.
🙂 it happens
Check out this bookmarklet… it does the copy and pasting for you
https://www.googledrive.com/host/0B1pwzJXH7GP8R3lnZFZUWWRhdk0/
Direct links like this for files doesn’t work for me since today :/
Any idea why? Folder and files are set to be public.
Like Casu, this has stopped working for me.
The Drive UI still shows a “Hosting” URL – but it yields a 403 (permission deinied).
Bummer- this no longer works now that Google has updated to the ‘New Google Drive’ 🙁
This works:
https://support.google.com/drive/answer/2881970?hl=en
No wonder why it’s now not working, this link answered why. Thanks, now I can move on
Thank you.
i share and .mkv in piblic the streaming not work and the download said 404 error!
You can also just plug the file ID itself into the hosting URL scheme (sharing must be set to either Anyone with link or Public on the web).
@Josh Yes. That’s what I wrote above.
It only works for a certain time (calls) with “/host”.
After that it redirects to a 404 page!
Any solutions?
@alex, I still don’t have trouble with this. It works every time.
OMG. Thank you. I finally got it to work!
does not work like suggested any longer. recieving a 404 and cannot any longer even find the hosting url for forwarding from my domain server….inyone know why>
I’m not seeing a problem.
thanks its working i put js in blogger finally with google drive
very great job
thank you
please explain me about using google drive as a download hosting
My experience is that the direct link stopped working sometime after Google’s official shutdown of hosting on September 1, 2016.
Before the shutdown I was able to use the url root as suggested by Dale
http://googledrive.com/host/0B4gwdXQk1LyieHZHSTBqd0VJSnc/…
For example this would work before the shutdown
http://googledrive.com/host/0B4gwdXQk1LyieHZHSTBqd0VJSnc/i30-dallas/construction/20150208-horseshoe-9146-1050.jpg
but now I get a 502 error.
Is the direct link definitely still working for anyone out there? If so, how are you doing it?
For me also stopped working, I am desperate because I really need this. Do you know any alternative?
I found that using this link: https://docs.google.com/a/example.com/uc?id= in place of http://googledrive.com/host/ works. Note that I’m using a Google for work account where example.com is my work domain, I haven’t discovered what link to use for personal a gmail account yet. So in your example above, I just need to add the file id to the end of this link:
https://docs.google.com/a/example.com/uc?id=
Checkout the drive files API to achieve this in a script if you have a bunch of images you need to relink to: https://developers.google.com/drive/v2/reference/files
I write integration scripts for a living so if you need professional help, do reach out as well.
I tried your technique in my Google Apps for Education account. No luck.
Yup. It looks like this trick has been stopped by Google.
The folder view option (above) still works, e.g. resolves to:
https://drive.google.com/drive/folders/0B42c3pO5_y67X0Fhcmg5XzhoR0U
but this only displays a (directory) list of the files. Getting them to display is another issue. Google drive knows how to display many types, but uses the Drive builtin viewer. Not quite the same as streaming the file to the mobile browser for display.
So I think you still can share a public link to directly access the file in a shared folder on Google Drive, say a picture file. You can use the following URL prefix:
https://docs.google.com/a/example.com/uc?id=
Then the ID is the id you get when you right-click the picture/file and click “Get Shareable Link”. In my case, I was getting the following:
https://drive.google.com/open?id=0B1kk0l_Tp7fWYnhMVVdMTWxnYVU
And so to access the file via a diret link, I now use:
https://docs.google.com/a/example.com/uc?id=0B1kk0l_Tp7fWYnhMVVdMTWxnYVU
Not sure how long this will work, but it seems to do the trick.
So I think you still can share a public link to directly access the file in a shared folder on Google Drive, say a picture file. You can use the following URL prefix:
https://docs.google.com/a/example.com/uc?id=
Then the ID is the id you get when you right-click the picture/file and click “Get Shareable Link”. In my case, I was getting the following:
https://drive.google.com/open?id=0B1kk0l_Tp7fWYnhMVVdMTWxnYVU
And so to access the file via a direct link, I now use:
https://docs.google.com/a/example.com/uc?id=0B1kk0l_Tp7fWYnhMVVdMTWxnYVU
Not sure how long this will work, but it seems to do the trick.
Yes after Google dropped this feature I’ve had to revert my code to use links of the form https://drive.google.com/uc?id=
e.g. here’s an image:
https://drive.google.com/uc?id=0B-5xeZI7ht6TV2tlUENmSm4zSDA
and here’s a json file:
https://drive.google.com/uc?id=0B4rKiNtdxe1NVEFnTmkzYTJlalU
Google is now redirecting those https://drive.google.com/uc?id= URIs. How annoying!
Also does anyone know a way to get the filename from the fileid?
Any suggestions on how to get a viewable link for this index.html file?
https://drive.google.com/uc?id=0B8R1QvA3x5IbVDk4NDNKRXh4MEk
The URL opens a download dialog, instead of processing the HTML stream.
The https://docs.google.com example does the same: tries to download.
index.html is in the public accessible folder:
https://drive.google.com/drive/folders/0B8R1QvA3x5IbWll3M0hIYXVLZlk
Google has put a stop to this. Dropbox stopped hosting HTML files too.
Google has put a stop to this. Dropbox stopped hosting HTML files too.
https://fibd26.blogspot.com