How to place a Progress Bar for a process in Flask?

Asked

Viewed 366 times

1

Hello,

By clicking the 'Send' button, the selected file (.jpg) is copied to several directories. I want to show this process to the user via a simple progress bar. Any hints?

this is part of my script to copy the selected file to other folders:

def copia_imagem():
    for root, dirs, files in os.walk(destination):
        for name in files:
            if fnmatch.fnmatch(name, 'imagem.jpg'): #Se já existir uma imagem com o mesmo nome, ela será renomeada
                os.rename(os.path.join(root, name), os.path.join(root, 'Imagem_'+date.strftime('%H%M%S__%d_%m_%Y')+'.jpg'))
        for dst in root:
            shutil.copy(os.path.join('C:/Python34/Scripts/static/img', 'imagem.jpg'), root)

My html code...

<form method=POST enctype=multipart/form-data action="{{ url_for('upload') }}">
    <input type=file name=photo multiple>
    <button type="submit" class="btn btn-primary btn-sm">Enviar</button>
    <div class="progress" style="width: 50%; margin: 50px;">
        <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 40%">
    </div>
</form>
  • you have tried bootstrap?

  • http://stackoverflow.com/questions/37531829/how-to-create-a-progress-bar-using-flask try this friendly solution

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.