mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-13 01:37:32 +02:00
Fix issue #37 - file uploading was not working as it should.
File uploading now works correctly from both the staff interface and from emails.
This commit is contained in:
@ -267,15 +267,16 @@ def update_ticket(request, ticket_id):
|
||||
)
|
||||
|
||||
if request.FILES:
|
||||
import mimetypes
|
||||
for file in request.FILES.getlist('attachment'):
|
||||
filename = file['filename'].replace(' ', '_')
|
||||
filename = file.name.replace(' ', '_')
|
||||
a = Attachment(
|
||||
followup=f,
|
||||
filename=filename,
|
||||
mime_type=file['content-type'],
|
||||
size=len(file['content']),
|
||||
mime_type=mimetypes.guess_type(filename)[0] or 'application/octet-stream',
|
||||
size=file.size,
|
||||
)
|
||||
a.file.save(file['filename'], ContentFile(file['content']))
|
||||
a.file.save(file.name, file, save=False)
|
||||
a.save()
|
||||
|
||||
ticket.save()
|
||||
|
Reference in New Issue
Block a user