Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #40275 > unrolled thread

Upload directory

Started byAndrew Poulos <ap_prog@hotmail.com>
First post2021-07-01 11:02 +1000
Last post2021-07-02 02:26 +0200
Articles 5 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  Upload directory Andrew Poulos <ap_prog@hotmail.com> - 2021-07-01 11:02 +1000
    Re: Upload directory JJ <jj4public@gmail.com> - 2021-07-01 13:10 +0700
    Re: Upload directory Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-07-01 12:55 +0200
      Re: Upload directory Andrew Poulos <ap_prog@hotmail.com> - 2021-07-02 08:34 +1000
        Re: Upload directory Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-07-02 02:26 +0200

#40275 — Upload directory

FromAndrew Poulos <ap_prog@hotmail.com>
Date2021-07-01 11:02 +1000
SubjectUpload directory
Message-ID<9rudnW-JDaqHiUD9nZ2dnUU7-WvNnZ2d@westnet.com.au>
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

[toc] | [next] | [standalone]


#40276

FromJJ <jj4public@gmail.com>
Date2021-07-01 13:10 +0700
Message-ID<1366nvcnoot3f$.962mszyr27w7.dlg@40tude.net>
In reply to#40275
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.

[toc] | [prev] | [next] | [standalone]


#40279

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2021-07-01 12:55 +0200
Message-ID<6351394.aQ5ZTYclbD@PointedEars.de>
In reply to#40275
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.

[toc] | [prev] | [next] | [standalone]


#40282

FromAndrew Poulos <ap_prog@hotmail.com>
Date2021-07-02 08:34 +1000
Message-ID<j8idnZ3TY8N_30P9nZ2dnUU7-eudnZ2d@westnet.com.au>
In reply to#40279
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

[toc] | [prev] | [next] | [standalone]


#40283

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2021-07-02 02:26 +0200
Message-ID<2450771.yXyze288zr@PointedEars.de>
In reply to#40282
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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web