new paths
This commit is contained in:
@@ -109,7 +109,7 @@ def merms_register_complete():
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
UPLOAD_FOLDER = '/app/uploads' # '/uploads'
|
UPLOAD_FOLDER = '/app/uploads' # '/uploads'
|
||||||
ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'}
|
ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'}
|
||||||
|
|
||||||
|
|
||||||
@@ -144,17 +144,20 @@ def upload_file():
|
|||||||
if file and allowed_file(file.filename):
|
if file and allowed_file(file.filename):
|
||||||
logger.info(f'POST CALLED 5 {file.filename}')
|
logger.info(f'POST CALLED 5 {file.filename}')
|
||||||
# logger.info(f'POST CALLED 5 {file.size}')
|
# logger.info(f'POST CALLED 5 {file.size}')
|
||||||
|
save_path=UPLOAD_FOLDER + "/" + "F000000000001"
|
||||||
filename = secure_filename(file.filename)
|
filename = secure_filename(file.filename)
|
||||||
final_save_path = os.path.join(UPLOAD_FOLDER, filename)
|
final_save_path = os.path.join(save_path, filename)
|
||||||
logger.info(f'POST CALLED 6 {final_save_path}')
|
logger.info(f'POST CALLED 6 {final_save_path}')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if not os.path.isdir(save_path):
|
||||||
|
os.makedirs(save_path)
|
||||||
|
|
||||||
file.save(final_save_path)
|
file.save(final_save_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Catches any other exception and stores the message in 'e'
|
# Catches any other exception and stores the message in 'e'
|
||||||
print(f"An unexpected error occurred: {e}")
|
print(f"An unexpected error occurred: {e}")
|
||||||
|
|
||||||
|
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
logger.info('GET CALLED')
|
logger.info('GET CALLED')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user