0

Using Flask and WTForms, I'm taking user uploaded files and spitting back results. Everything works fine, but now the user would like to see (in the results) the complete file path of the files they uploaded. This data does not appear to show up in the Flask files data.

EDIT: The file path the user wants to see is the path from the client side, not the path on the server. They'll upload a data file from a path like C:\\Path\To\All\My\Data\HWX123987123\000001.txt and want the results they see to reflect that path.

What I thought would exist:

>>> request.files.getlist(FILES)[0].filepath
'C:\\Path\To\All\My\Data\HWX123987123\000001.txt'

What I have:

>>> request.files.getlist(FILES)[0].filename
'000001.txt'

Is there any way to get the equivalent response from my imaginary filepath property? Thanks!

pgoldste
  • 105
  • 7
  • Are you saving these files somewhere on the server? Or just processing them before `request.files` goes out of scope? Flask keeps uploaded files in memory if they are small enough, so there won't be a path to send the user in that case. – Brad K. Apr 12 '16 at 14:55
  • I am saving them on the server while computation is done, yes. Perhaps I was unclear: I need my app to know the file path on the **client** side. The file names themselves are uninformative but the client uploads them from directories with significant names. – pgoldste Apr 12 '16 at 15:04

0 Answers0