V8-archive: File Uploads - Sub directories

Created on 25 Oct 2018  Â·  9Comments  Â·  Source: directus/v8-archive

Hey all,

I've been trying to figure out a way to be able to upload files into subdirectories instead of everything to be under /uploads/_/originals/ because users are dumb. they won't know a file w the same name (logo.png for vendor1 is already there when trying to upload logo.png for vendor2).

Anyhows, I finally made my way to CoreServicesProvider::getEmitter().

still not quite sure how to do it, gonna look at this function. I just posted this in case someone figured it out already.

Thanks all :)

enhancement help wanted

Most helpful comment

I will leave this open as it was closed due to inactivity by the slate bot. It seems there's still some interest in this to be implemented.

All 9 comments

Hey @bluesangria – the duplicate file problem (#499) should be resolved tomorrow, would that help with this issue?

As for sub-directories, we were thinking about implementing virtual directories so files can be organized in the App and grouped in API responses... but I don't know if we'll be mirroring those virtual folders with real filesystem ones. That might be a nice feature to add in the future (mirroring virtual/actual folders) though... but I think we should have https://github.com/directus/app/issues/228 resolved before we start into that.

Thoughts?

The duplicate file resolutions helps with the initial issue I had.

I'm not a big fan of one directory with all the files in there and letting "normal users" upload whatever they feel like.

For my specific scenario, I have:
35 locations, each with different photo galleries (3 - 12 pics each).
800 products (each with 1 to 8 pics).
2 dozen reps w mug shots.
600 blog posts with pics too.
3 dozen manufacturers w logos.

I have around 4000 to 5000 files right now.

I'll keep playing around with it and see if I can come up with something.

Thanks!
JG

I agree that actual directories would be a nice feature, but we would need a way for the UI to manage those first. I would certainly be down to discuss this further, but I feel like it will have to be a PR if you need it added in the short-term (our devs our pretty swamped). :)

devs are always swamped :)

I looked up the virtual folders system that you have in mind. You're right, it will need to be a longer discussion. I'm afraid that it will get very confusing between real folders, virtual folders and managing it all.

I will focus on my problem for now.

Food for thought, maybe it's a configuration feature for storage like: 'folderMode' => 'virtual|physical' it may allow to preserve all the logic u have in the API.

I see actual _directories_ as a natural next step once we have _virtual_ folders. Whenever the user creates a folder in directus_folders we piggyback that event to also create a filesystem directory. Same thing happens when they move a file/folder into a folder... we move the actual file.

That part is easy and would only take a few extra hours to implement (once we have the virtual ones done). The trickier part is handling all of the exceptions (duplicate file names, how this works in different storage adapters, etc).

Either way, best of luck with your implementation... we'll follow up here once we have folders up-and-running!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I will leave this open as it was closed due to inactivity by the slate bot. It seems there's still some interest in this to be implemented.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

To achieve better clarity/visibility, we are now tracking feature requests within the Feature Request project board.

This issue being closed does not mean it's not being considered.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

24js picture 24js  Â·  3Comments

maettyhawk picture maettyhawk  Â·  3Comments

cdwmhcc picture cdwmhcc  Â·  3Comments

chintohere picture chintohere  Â·  3Comments

cdwmhcc picture cdwmhcc  Â·  3Comments