I am using Django Uplodify S3 and I am having problems with its operation. Files begin to load (progress is shown), then they simply pause for an indefinite time or lead to an “Http error”.
My python code is pretty much identical to the given sample code. I run this on my local machine using the dev server.
I keep getting HTTP 400 error, Amazon reports that there are additional fields in the POST request that I did not specify in my policy.
After looking at the mouad link, I made some changes to my policy to try to include all the files that I should be, but I'm not sure if I declared them correctly, since the documentation for the Django Uploadfiy module is a bit unclear. Here is what I have:
@render
def upload_example(request, object_id):
options = {"onError":"function (a,b,c,d) {alert('Error: '+d.type+' Info: '+d.info)} "}
key_pattern = 'example-%s/${filename}' % object_id
post_data={
'key': key_pattern,
'success_action_status': "201",
"starts-with": object_id
}
conditions={
'key': { 'op': 'starts-with',
'value': ["$Filename", "$folder", "$key", "$Filedata", "$starts-with", "$Upload"], }
}
uploadify_options = uploadify_s3.UploadifyS3(
uploadify_options = options,
post_data=post_data,
conditions=conditions
).get_options_json()
return ['s3.html', {"opt": uploadify_options}]
I am most concerned about that 'key', whose value changes at upload time. Note that the condition value. I am not sure how to declare the value key. The documentation is not entirely clear.
And here is the error log from Amazon:
7654158c29cb89182a7a8836253c91d61945e514e4a738ee1f502eda245f71e0 joshhunttest [08/Jun/2011:05:24:34 +0000] 137.166.55.199 - 8212E79B67E4469F REST.GET.OBJECT crossdomain.xml "GET /crossdomain.xml HTTP/1.1" 200 - 215 215 199 198 "http://localhost:8000/static/uploadify/uploadify.swf" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.10 Safari/535.1" -
7654158c29cb89182a7a8836253c91d61945e514e4a738ee1f502eda245f71e0 joshhunttest [08/Jun/2011:05:24:35 +0000] 137.166.55.199 - FDA8CED6EF7C3A19 REST.POST.BUCKET "POST / HTTP/1.1" 400 MaxPostPreDataLengthExceeded 360 - 1010 - "-" "Adobe Flash Player 10" -