ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

fileUpload - possibility of obtaining the file path in the FileUpload.value metadata

Open aideenf opened this issue 5 years ago • 3 comments
trafficstars

Hi There It would be great if I could obtain the file path from the fileUpload Widget. Maybe in the metadata section which currently contains the name but not the path.

{'law_data.csv': {'metadata': {'name': 'law_data.csv', 'type': 'text/csv', 'size': 981371, 'lastModified': 1563733119625},

I love ipywidgets... thank you!!

aideenf avatar Aug 19 '20 17:08 aideenf

I think we don't have access to the path, just the filename: https://developer.mozilla.org/en-US/docs/Web/API/File

However, https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Value indicates that the input might have the path to the first file? Or the browser may just put the filename in there without the path. If you want to investigate if the browser file input exposes the path, that would be the first step, I think.

jasongrout avatar Aug 19 '20 17:08 jasongrout

Thanks a lot for the fast reply, I will investigate.

aideenf avatar Aug 19 '20 17:08 aideenf

I just found ipyfilechooser (in pypi) extremely useful to that use-case. I believe this is also what you were looking for, @aideenf

chbrandt avatar Dec 19 '23 16:12 chbrandt