What is the best way to upload a folder to a website?

前端 未结 7 1977
星月不相逢
星月不相逢 2020-12-01 16:51

I need an easy way to allow users to upload multiple files at once (ie I need to allow a user to upload a folder). I do not wish to put the burden of zipping on the user.

7条回答
  •  执念已碎
    2020-12-01 16:52

    This isn't a pure js/html solution. As EndangeredMassa has pointed out, it's not possible. In fact, this idea is an IE/Windows only solution. I don't recommend it, but it can work.

    So, all disclaimers aside ...

    Many years and several employers ago, we used to do some client side stuff that instantiated the FileSystemObject. It would iterate through each of the files and pass them through to the server one at a time. Can't remember the details of how we did that :o(

    Anyway, this usually meant that the client box would need to have to add the site to the list of trusted sites and give trusted sites a bunch of permissions that are turned off (for very good reasons). Stuff like the ability to Initialize and script ActiveX controls not marked as safe. That kind of thing.

    I know that this isn't a perfect answer, but it could point you in the right direction.

提交回复
热议问题