import os
from flask import current_app

def allowed_file(filename):
    return '.' in filename and filename.rsplit('.', 1)[1].lower() in {'doc', 'xls', 'ppt', 'pps', 'bin'}

def save_file(file):
    filepath = os.path.join(current_app.config['UPLOAD_FOLDER'], file.filename)
    file.save(filepath)
    return filepath

def delete_file(filepath):
    os.remove(filepath)
    
