I need to know it to correctly get filedata from POST dictionary.
I want to use Agile Uploader (resizes images on client side before upload on the server) in my project. It has process.php file as example of handling image on server. In that file:
$tmp_name = $_FILES["Filedata"]["file_name"]; // where "tmp_name" is file name
As Pyramid doesn’t have FILES dictionary, I supose I have to find image in POST. But when I try to upload image POST is empty…
So where it send that image and how to find it on server side?
HTML (most part of html code taken from their demo):
<form action="/test" method="post" id="singularDemo" enctype="multipart/form-data">
<div id="single"></div>
</form>
<a href="#" onClick="document.getElementById('agileUploaderSWF').submit();">Submit</a>
<script type="text/javascript">
$('#single').agileUploaderSingle({
submitRedirect:'',
formId:'singularDemo',
progressBarColor:'#3b5998',
flashVars:{
firebug:true,
form_action:'/test'
}
});
</script>
Python (Pyramid code), just for testing – simple view:
def test(request):
if request.method == 'POST':
pass
return {}
Thanks!
Since the
$_FILESglobal contains files submitted by aPOSTrequest, you can access them usingrequest.POST:This is an exact equivalent of the PHP
$_FILESvariable, so if it doesn’t work, something else must be wrong.The Pyramid cookbook has more information about file uploads.