I'm trying to open a pdf file on the input click. Please let me know if it's possible on not?
This is my form
<form>
<input type="text" name="response"/>
</form>
I know if I want to open a file I should take type=file
and when I click Enter
I want to open a pdf file.
view to open a pdf file.
def pdf_view(request):
try:
return FileResponse(open('resume.pdf', 'rb'), content_type='application/pdf')
except FileNotFoundError:
raise Http404()
The above view works fine i.e when I click /pdf/
it renders the pdf in browser but is it possible to open a file when I type pdf
in text field and it renders a file for me ?