2

I would like to download asset files from Craft 3 dashboard.

Those files are out of web folder because of security reason. I made "documents" folder just under the root of the project, and the files are in there.

However, the function of "download file" does not work, although "preview file" and "Edit image" works. I think it is strange.

Do you have any idea to download the private files?

4
  • I doubt this will be possible without PHP. You'll need to serve the file on your own and let yii2 set the correct headers. But without php there won't be a way since you can't access the original file Apr 10 '19 at 18:47
  • Hmm, I don't think you are right. Clearly Craft's built in "Preview file" option can access my image, even though it's in a private folder. And after inspecting the URL of my image in the Preview window, I can see that it has a special "private" URL (e.g. http://<host_name>/cpresources/42d9d924/file7.png?v=1554913720). So clearly Craft has a way of serving this file, without me doing any additional PHP.
    – Kota.M
    Apr 10 '19 at 20:42
  • So why it doesn't use this link for its "Download file" option too? Even better, if I copy and paste myself this private URL in my browser, "voila" here is my fully functional download link! Of course, we can't expect our clients to download the files this way. This clearly looks like a Craft CMS bug.
    – Kota.M
    Apr 10 '19 at 20:42
  • Please note: I said the original file. Everything in the cp resource folder are just temporary, often croped files. But yeah you can use those too if you like Apr 10 '19 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.