How do I uploading directories with sub-directories?

So I want to create a server that you can upload folders to and then add that directory to IPFS. But I need to maintain sub-directories as well. I basically want to have a similar feature to the IPFS desktop. Where it can accept a directory and include all sub-directories as well. So when you inspect the hash you can see the subdirectories as well. I know this is basically not an IPFS question. But would anyone be able to share some input on how to do this? I currently am able to accept a directory, and grab all files within the directories. But I want to maintain the directories as well: This is the structure I want to have.

And this is the structure I currently have:
where all the images and .ico are in images/ and styles.css is in css/ and index is in root.

This is to be enable website publishing on IPFS without having to host your own node. I know there are many services to do this already. So this is just to experiment with and learn.

Just looking around it looks like Dropzone.js supports uploading directories and contents Dropzone.js

1 Like