1

I am getting a file from user which is of xlsx or CSV format. I am saving the data of the files into my database using "django-excel". But after I perform request.FILES['file'].save_to_database() then if I try to access the uploaded file's contents using request.FILES['file'] again then I am unable to access them. How can I resolve this problem?

Striezel
  • 3,693
  • 7
  • 23
  • 37

1 Answers1

0

Does your HTML form have this attribute?

<form method="POST" enctype="multipart/form-data">
</form>

You need this 'enctype' to access the request.FILES

zubhav
  • 1,519
  • 1
  • 13
  • 19
  • Yes it does , i am able to access the files but once I open the files and use them then i am unable to reuse them. lets say a user uploaded the file named foo.xlsx , I open the sheet and take out some values . then I try to apply the same operation request.FILES['file'].save_to_database() which fails . – Sourav Aggarwal Oct 15 '16 at 18:30