1
votes

In a flask application, I have a <input type="file"...> When I click in send button the python print the variable file_name to show me the path of the file selected. Path of the selected file

Python side

if request.files:
    arquivo = request.files['arquivo']
    file_name = os.path.abspath(arquivo.filename)

HTML side:

<div class="anexar">
    <input type="file" name="arquivo" class="form-control obj-center" accept=".jpg, .png, 
    .bpm, .jpeg, .txt, .zip, .pdf, .doc, .docx, .ppt, .pps, .pptx, .xls, .xlsx, .gif, .avi, .mpg, .sgv">

</div>
    <input class="skype-btn-envia-msg" type="submit" value="Enviar Mensagem">

The print resulted is:

==============================
Nome: Luis Roberto Porto Mendes --> Seu ID é: portinho199
==============================
Send a file. [25/05/2022 | 16:18]
==============================
G:\Meu Drive\DEV\Projetos\Carometro v1.2\File.txt
==============================

The real path is c:\Temp\file.txt, but retuns G:\Meu Drive\DEV\Projetos\Carometro v1.2\File.txt

Can you orient me about this