I don't want the file to be saved on my server, I just want the file to be read and printed out in the next page. Right now I have this.
(index.html)
<form name="fileUpload" method="post">
<input type="file" />
<input type="submit" value="Submit" />
</form>
And I'm trying to do something like this-
def upload_file(request):
if request.method == "POST":
upload = request.POST.get('fileUpload').read()
return render(request, 'directory/return.html', {'output': upload})
else:
return render(request, 'directory/index.html')
But obviously that just doesn't work. I want it to work for text files and csv files.
Thank you.