1

I'm new to Django and want to give a user the ability to browse through their local files and "upload" them. However I do not actually want to store their files on my database, I only want to get the filename, path, memory etc of the file the user has selected. I have read through Need a minimal Django file upload example, and many more sites, but everything talks about uploading a file. Any advice would be appreciated!

Thanks

Community
  • 1
  • 1
Kevin
  • 23
  • 3

1 Answers1

1

The only interface to local files available in a web browser is the File-picker, as if to select a file for upload. But, you don't have to upload the files! You can work with them in Javascript instead. See for example's Mozilla's documentation on "Using files from web applications".

Note that the Javascript File objects you get back have name, size, and [MIME] type properties.

Your client-side Javascript could poke these into a form, that the user then submits to your server-side Django application. Or, the client-side Javascript could put them into an AJAX action that submits them to the server-side Django application.

gojomo
  • 52,260
  • 14
  • 86
  • 115