XP: Help on File upload

Enonic version: 6.5.1
OS: OS X El Capitan

Hey there folks,

In one of my pages I have a form, where the user can upload a pdf. I can successfully get the data stream from that uploaded file in my service, how can I proceed about creating that file in the server? Documentation isn’t clear about any of that. Thanks!

So, correct me I’m wrong, but the enonic way to do that is as follow:
Create a media content using the file stream;
When needed to download/display that file again, create an attachmenturl, using the portal lib;
Enjoy.

Is that about right? That’s what I ended up having here.

2 Likes

Yes, that’s correct :slight_smile:

1 Like

So, one last thing on that:
Is there a way to make sure that any user with a download link to an attachment on my server, will be required to log-in in order to properly download it?

Like this:
I have an attachment called at1.jpg on enonic, and I create a download link to it, like myserver.domain/at1.jpg?download=true (you get the picture).

To download the file at1.jpg from the url myserver.domain/at1.jpg?download=true, you’d have to be logged in with an account that have enough privileges to read that content.

Is there any built-in way to do this?

If you remove the role “Everyone” from the file then users who are not logged in cannot see or download it. Only logged in users who have read access can get it.

2 Likes