Is there a simple way to allow the user to select a folder from a Django form? I want to use the same widget as for a FileField, but only allow the user to select a folder so I can process all the files in that folder.
Thanks.
Changing Directories (pwd) In order to go backwards, or up your file system tree, (i.e. go from Desktop/ back to Rohan/), you have to use the command "cd ..": cd ..
FilePathField in Django Forms is a string field, for input of path of a particular file from server. It is used for select inputs from the user. One needs to specify which folders should be used in FilePathField and field displays the inputs in form of a select field. The default widget for this input is Select.
The is_valid() method is used to perform validation for each field of the form, it is defined in Django Form class. It returns True if data is valid and place all data into a cleaned_data attribute.
It is impossible, you will never receive a directory name back from the type="file" input button
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With