Skip to content

Instantly share code, notes, and snippets.

View dave-flr's full-sized avatar
💜
hello_friend

David Flores dave-flr

💜
hello_friend
View GitHub Profile
@armsp
armsp / Class_File_Upload.py
Last active June 11, 2020 08:20
Upload files to flask restful server in two different ways. First is a proper upload and the other copies file from a given location to server's location by only providing the file path of file to copy in the URL itself.
import os
from flask import Flask, Response, request, jsonify, redirect, send_from_directory
from flask_restful import Api, Resource
from werkzeug.utils import secure_filename
class file_operation:
def __init__(self):
self.APP_ROOT = os.path.dirname(os.path.abspath(__file__))
self.UPLOAD_FOLDER = os.path.join(self.APP_ROOT, 'upload_folder_logreg')
self.ALLOWED_EXTENSIONS = set(['txt', 'csv'])