I spent 2 night to solve this ploblem...
My first question in stackoverflow
In views.py
def upload_file(request):
if request.method == 'POST':
form = UploadFileForm(request.POST, request.FILES)
if form.is_valid():
form.save()
return HttpResponseRedirect('../../analysis')
else:
form = UploadFileForm()
return render(
request, 'blog/upload.html', {'form': form}
)
In models.py
class UploadFileModel(models.Model):
title = models.TextField(default='')
file = models.FileField(null=True)
I implemented excel,csv file's uploading in my website.
And file is saved in '_media' folder.
I want to execute machine running code with this excel file.
How can i get name of uploaded file?
Plz...
Aucun commentaire:
Enregistrer un commentaire