fohrloop / dash-uploader

The alternative upload component for python Dash applications.
MIT License
141 stars 29 forks source link

possible to return only the local filepath on file explore #123

Closed matt-sd-watson closed 9 months ago

matt-sd-watson commented 1 year ago

Currently, the upload component will make a copy of the selected file from the user's file system in specific directory, such as tmpdir. Is it possible to just return the local file path from the file search, so that the user may (when running locally) read directly from the filepath?

mapix commented 9 months ago

This sounds good, but it seems that this might not be the goal of this project (Dash's entire ecosystem is mainly focused on the Web world rather than native systems).

mapix commented 9 months ago

@matt-sd-watson

I will close this issue, as my understanding is that this question will be unrelated to the future of the current project. Thank you for your contribution to this idea.

cc @fohrloop

fohrloop commented 9 months ago

If I understand correctly the request was to have a javascript component that would never send anything but the local file path (no data). I can see there could be some use cases for Dash apps meant to be ran locally.

The cleanest option, possibility to just send the selected filename, and not the file contents, requires quite many changes in the package and especially the JavaScipt side. I'm not sure if this should be supported, but as said, I see the special use case.

Then there are two workarounds which are probably feasible of your data is not enormous in size (1) just have the callback to remove the file after "upload". (2) perhaps, using a subclass of du.HttpRequestHandler as http_request_handler argument to du.configure_upload could solve this? Did not give it a lot of thought how exactly but perhaps it could be possible to just not save the data packets in the backend.

Niko

mapix commented 9 months ago

@fohrloop

Based on my understanding of the current project, some components like File Browser or File Manager might be more suitable for this scenario. My suggestion is not to include this topic in this project.

fohrloop commented 9 months ago

I agree. If there are already existing components for just selecting a file, then most probably one should use it for selecting files instead of dash-uploader.

mapix commented 9 months ago

@matt-sd-watson You can take a look at this project, it seems pretty good.

https://github.com/Tauffer-Consulting/dash-cool-components