31 lines
907 B
Python
31 lines
907 B
Python
![]() |
from django.shortcuts import render, redirect
|
||
|
import os.path
|
||
|
|
||
|
def uploadContent(request):
|
||
|
if request.method == "GET":
|
||
|
return render(request, "uploadChoice.html")
|
||
|
elif request.method == "POST":
|
||
|
choice = request.POST["choices"]
|
||
|
if choice == "image":
|
||
|
return redirect("/upload_image/")
|
||
|
elif choice == "video":
|
||
|
return redirect("/upload_video/")
|
||
|
else:
|
||
|
return
|
||
|
else:
|
||
|
return
|
||
|
|
||
|
def imageUpload(request):
|
||
|
if request.method == "GET":
|
||
|
return render(request, "uploadImage.html")
|
||
|
elif request.method == "POST":
|
||
|
image = request.POST["image"]
|
||
|
# add the id of the user, after you add in users
|
||
|
savingImage = open(f"static/{image}","wb")
|
||
|
for i in image:
|
||
|
savingImage.write(i)
|
||
|
savingImage.close()
|
||
|
return redirect(f"/static/{image}")
|
||
|
else:
|
||
|
return
|