allenchienxxx commited on
Commit
f75d3c5
1 Parent(s): 4a604a4

Update analze.py

Browse files
Files changed (1) hide show
  1. analze.py +2 -3
analze.py CHANGED
@@ -31,9 +31,8 @@ def check_file_type(file):
31
  return "Please select .eml or .txt file."
32
 
33
  def save_file(file):
34
- file_path = 'email files/' + file.filename
35
- with open(file_path, 'w') as f:
36
- f.write(file.read().decode('utf-8'))
37
 
38
  def text_feature(filepath):
39
  text = get_text(filepath)
 
31
  return "Please select .eml or .txt file."
32
 
33
  def save_file(file):
34
+ with open(os.path.join('email files/', uploaded_file.name), 'wb') as f:
35
+ f.write(uploaded_file.getbuffer())
 
36
 
37
  def text_feature(filepath):
38
  text = get_text(filepath)