Hi Yong Zu Yi,
Based on the screenshot you provided, it looks like you're trying to retrieve an audio file from the request's POST data using the
However, audio files should be sent as part of the request's FILES data, not POST data.
To retrieve the audio file from the request's FILES data, you should use the
request.FILES dictionary instead.
I have attached a screenshot of a modified code, I first check if the audio file is present in the
request.FILES dictionary. If it's not present, I simply return a 400 Bad Request response. If it's present, create a filename based on the current user's username and the current date and time, and save the audio file to the server using the
open function and a for loop to write the file in chunks.
I hope this helps you solve the issue you were facing. Let me know if you have any further questions.
Python Like English
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BbC3qWB%3DUfUHdo_MdxeBXgLtD3yNTdOkHWo5ExK3uv8O3%3DXDg%40mail.gmail.com.