I am trying to make a web application sing flask in python3. to do so, I am using the following code to upload the files and save them in a folder:
app = Flask(__name__)
Bootstrap(app)
db = SQLAlchemy(app)
# Configuration for File Uploads
files = UploadSet('files',ALL)
app.config['UPLOADED_FILES_DEST'] = 'static/uploadsDB'
configure_uploads(app,files)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///static/uploadsDB/filestorage.db'
# Saving Data To Database Storage
class FileContents(db.Model):
id = db.Column(db.Integer,primary_key=True)
name = db.Column(db.String(300))
modeldata = db.Column(db.String(300))
data = db.Column(db.LargeBinary)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/dataupload',methods=['GET','POST'])
def dataupload():
if request.method == 'POST' and 'csv_data' in request.files:
file = request.files['csv_data']
filename = secure_filename(file.filename)
file.save(os.path.join('static/uploadsDB',filename))
fullfile = os.path.join('static/uploadsDB',filename)
but the problem is that I can not upload all the files at the same time and every time I have to go back to the previous page and upload the next file and this makes problem. how can I fix this problem to be able to upload all the files together?