Quick notes - I'm trying to upload random size files to save at datastore using GAE.
Here is basic code:
HTML Code
<iframe name="upload_iframe" src="" style="display:none;"></iframe> <form method="post" enctype="multipart/form-data" action="/"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <input name="data_file" size="30000" type="file" /> <input type="submit" name="submit" value="Upload" /> </form>
Python / Django Code
def upload_files(request): if request.method == 'POST': logging.info(request.FILES) logging.info(request.FILES['data_file']) return HttpResponse('File Uploaded Successfully..')
Test scenario :
If i try to upload ~1 Mb file, its working fine.. returns
File Uploaded Successfully
if trying to upload ~2 Mb or more then it raises
MultiValueDictKeyError: "Key 'data_file' not found in <MultiValueDict: {}>"
:- not able to picked up where am i doing wrong here or using wrong approch..
I referred this SO Question too..but its not working for me.
Please suggest you thought on above..