Changed page flow to first save file and then redirect to check.

On check numbers in file are validated.

Posting to check then uploads file to s3
This commit is contained in:
Adam Shimali
2016-01-13 17:32:40 +00:00
parent 7c246ba3ac
commit 4dcb180da1
7 changed files with 106 additions and 38 deletions

15
app/main/uploader.py Normal file
View File

@@ -0,0 +1,15 @@
import os
import uuid
from boto3 import resource
# TODO add service name to bucket name as well
def s3upload(filepath):
filename = filepath.split(os.path.sep)[-1]
upload_id = str(uuid.uuid4())
s3 = resource('s3')
s3.create_bucket(Bucket=upload_id)
key = s3.Object(upload_id, filename)
key.put(Body=open(filepath, 'rb'), ServerSideEncryption='AES256')
return upload_id