How to upload a folder using IPFS API


I want to add a folder (including all the files and subfolders in it) using the IPFS API. Please suggest a method for doing the same.

Currently I am using html and jquery to input the folder as shown below:-


<form id="file-catcher">
      <input id="file-input" type="file" webkitdirectory mozdirectory multiple>
          <p>Drag your folder here or click in this area</p>
      <button type="submit" name="upload">Upload</button>


$(document).ready(function() {
  $('form input').change(function () {
    $('form p').text(this.files.length + " file(s) selected");

var inps = document.querySelectorAll('input');
[], function(inp) {
  inp.onchange = function(e) {

Also, please suggest a method to handle the uploaded folder using javascript.


Hey, have you solved the issue? If yes, please share how did you do this?

How the different parts to the /add need to look like for ipfs to understand the file hierarchy is explained here: HTTP API | IPFS Docs.