file orbit
file orbit
file orbit
1
Table of Contents
2
1.Introduction
• Purpose
• Problem statement
• Overview
Benefits:
4
2. Software Requirement
5
3.System Requirement
6
4.Design
5.Output
7
8
Codes
9
return send_from_directory(app.config['UPLOAD_FOLDER'],
filename)
@app.route('/download/<int:file_id>')
def download_file(file_id):
file = File.query.get_or_404(file_id)
return send_from_directory(app.config['UPLOAD_FOLDER'],
file.filename, as_attachment=True)
@app.route('/upload', methods=['GET', 'POST'])
def upload_file():
if request.method == 'POST':
file = request.files['file']
filename = file.filename
filepath = os.path.join(app.config['UPLOAD_FOLDER'],
file.save(filepath)
new_file = File(filename=filename, filepath=filepath)
db.session.add(new_file)
db.session.commit()
return redirect(url_for('index'))
return render_template('upload.html')
if _name_ == '_main_':
with app.app_context():
db.create_all()
if not os.path.exists(app.config['UPLOAD_FOLDER']):
os.makedirs(app.config['UPLOAD_FOLDER'])
app.run(debug=True)
10
6.Bibliography
References:
11