Django FILES upload: path and filename
When an uploaded file is received by the Django server, its name can be read using UploadedFile.name
If filename in the multipart-data conten开发者_StackOverflowt contains a path like: '/a/b/c', UploadedFile.name seems to contain '/c' . How can I retrieve the full path and not just the file name.
Thanks.
Laurent Luce
You can't. Many browsers won't ever send the whole path, as a security measure to prevent information leakage.
What's more you know nothing about the file and path naming conventions in force on the user's computer, so there is little you can do with the submitted name. Don't do anything that relies on a submitted filename.
精彩评论