xrmx commented on a change in pull request #4298: Refactor import csv
URL:
https://github.com/apache/incubator-superset/pull/4298#discussion_r164988603
##########
File path: superset/utils.py
##########
@@ -513,6 +513,18 @@ def table_has_constraint(table, name, db):
return False
+def upload_file(file):
+ """Takes in the name of the file to be uploaded and uploads that file"""
+
+ from superset import app
+ config = app.config
+ if not file or not file.filename:
+ raise Exception("No file chosen for upload")
+ file.save(os.path.join(config['UPLOAD_FOLDER'], file.filename))
+ if file.filename not in os.listdir(config['UPLOAD_FOLDER']):
Review comment:
Can this happen in practice, i assume file.save will return or raise
something in case of error
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services