• Upload directory

    From Andrew Poulos@21:1/5 to All on Thu Jul 1 11:02:13 2021
    How do you allow the user to select a directory (that includes multiple
    files and sub-directories) and then upload that to a server while
    keeping the existing directory structure?

    I found webkitdirectory but MDN doesn't recommend using it.

    Andrew Poulos

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JJ@21:1/5 to Andrew Poulos on Thu Jul 1 13:10:50 2021
    On Thu, 1 Jul 2021 11:02:13 +1000, Andrew Poulos wrote:
    How do you allow the user to select a directory (that includes multiple
    files and sub-directories) and then upload that to a server while
    keeping the existing directory structure?

    I found webkitdirectory but MDN doesn't recommend using it.

    Andrew Poulos

    webkitdirectory is the only thing which allow multipart file names to have (relative) path.

    Without webkitdirectory, you'll have to construct the multipart data and provide the required HTTP request headers manually.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas 'PointedEars' Lahn@21:1/5 to Andrew Poulos on Thu Jul 1 12:55:59 2021
    Andrew Poulos wrote:

    How do you allow the user to select a directory (that includes multiple
    files and sub-directories) and then upload that to a server while
    keeping the existing directory structure?

    Accept only (compressed) archive files:

    <https://en.wikipedia.org/wiki/List_of_archive_formats>

    Every modern file manager includes a way now to create such an archive file.

    --
    PointedEars
    FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
    Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Poulos@21:1/5 to Thomas 'PointedEars' Lahn on Fri Jul 2 08:34:09 2021
    On 1/07/2021 8:55 pm, Thomas 'PointedEars' Lahn wrote:
    Andrew Poulos wrote:

    How do you allow the user to select a directory (that includes multiple
    files and sub-directories) and then upload that to a server while
    keeping the existing directory structure?

    Accept only (compressed) archive files:

    <https://en.wikipedia.org/wiki/List_of_archive_formats>

    Every modern file manager includes a way now to create such an archive file.


    So you're saying that I should instruct the user to archive the
    directory they want uploaded and then (in the web page) select the archive?

    Andrew Poulos

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas 'PointedEars' Lahn@21:1/5 to Andrew Poulos on Fri Jul 2 02:26:03 2021
    Andrew Poulos wrote:

    On 1/07/2021 8:55 pm, Thomas 'PointedEars' Lahn wrote:
    Andrew Poulos wrote:
    How do you allow the user to select a directory (that includes multiple
    files and sub-directories) and then upload that to a server while
    keeping the existing directory structure?

    Accept only (compressed) archive files:

    <https://en.wikipedia.org/wiki/List_of_archive_formats>

    Every modern file manager includes a way now to create such an archive
    file.

    So you're saying that I should instruct the user to archive the
    directory they want uploaded and then (in the web page) select the
    archive?

    I suggest to have two “input” elements: One where you use the “webkitdirectory” attribute, another one where you only allow the upload of an archive file. You could make the choice more obvious by using radio
    buttons that cause only one of the “input” elements to be shown.

    (And, if you wish, an extensible group of input controls with which several files of supported types can be uploaded. But note that you can also have
    one “input” element where several files can be selected.)

    Be sure to check the MIME media/file type server-side, too.

    --
    PointedEars
    FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
    Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)