Django Show files on disk

I want to have a page that will display files from a specific folder on disk, and the user can select one and then "pass" the file path of that file to another view for further processing. I have no idea where to start, all my searches show downloading files.

+3
file django


source to share


2 answers


If you only need to display files from one directory on disk, perhaps a simpler solution would be to use Django's built-in FilePathFeld . It will return the path as value and will be represented by the selection in the forms.



This field is not for uploading a file, it is only for selecting a pre-existing file.

+1


source to share


The only project I know of that is still supported is django-filebrowser The
extension is quite flexible, you can use paths relative to storage location or absolute server paths.
You should be able to pass the path to another view by adding the view path to the action attribute of the form like this:



<form name="form" method="post" action="/path/to/view">
  ...
</form>

      

0


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics