Spaces:
Runtime error
Runtime error
Update app.py
Browse files57 unmodified lines5859606162636465666 unmodified lines73747576777879808182838485868788899057 unmodified linestry:# Check if 'files' part is in the requestif 'files' not in request.files:flash('No file part')logging.warning("No file part found in the request")return redirect(request.url)files = request.files.getlist('files') # Get all files from the requestif not files or all(file.filename == '' for file in files):6 unmodified linesif file:filename = file.filenamefile_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)# Save the filetry:file.save(file_path)uploaded_files.append(filename)logging.info(f"Uploaded file: {filename} at {file_path}")except Exception as save_error:logging.error(f"Error saving file {filename}: {save_error}")return jsonify({'message': f"Error saving file {filename}"}), 500session['uploaded_files'] = uploaded_files # Store the uploaded files in sessionflash('Files successfully uploaded')logging.info(f"Files successfully uploaded: {uploaded_files}")return jsonify({'message': 'Files successfully uploaded',57 unmodified lines585960616263646566676 unmodified lines7475767778798081828384858687888990919257 unmodified linestry:# Check if 'files' part is in the requestif 'files' not in request.files:print("request.files-------------->",request.files)flash('No file part')logging.warning("No file part found in the request")return jsonify({'message': "No file part found in the request"})files = request.files.getlist('files') # Get all files from the requestif not files or all(file.filename == '' for file in files):6 unmodified linesif file:filename = file.filenamefile_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)print("file_path-------------->",file_path)# Save the filetry:file.save(file_path)uploaded_files.append(filename)logging.info(f"Uploaded file: {filename} at {file_path}")print(f"Uploaded file---------->: {filename} at {file_path}")except Exception as save_error:logging.error(f"Error saving file {filename}: {save_error}")return jsonify({'message': f"Error saving file {filename}"}), 500# session['uploaded_files'] = uploaded_files # Store the uploaded files in session# flash('Files successfully uploaded')logging.info(f"Files successfully uploaded: {uploaded_files}")return jsonify({'message': 'Files successfully uploaded',
app.py+6-4