Reputation: 41
I am trying to use the Uploadify plugin with Spring MVC in order to upload a bunch of files. I am authenticated but my request keeps getting denied because when the flash based plugin makes a request, it is lacking the session id. There are bunch of examples on how to make this work with php.. I couldn't find any help for this case in the forum. Any ideas?
$('#uploadify_upload').uploadify({
'uploader' : '../js/uploadify.swf',
'script' : '/myproj/FileUploader/upload,
'cancelImg' : '../images/uploadify-cancel.png',
'auto' : false,
'multi' : true,
'scriptAccess' : 'always',
'checkExisting': false,
'onComplete' : function(event,ID,fileObj,response,data) {
alert("complete");
},
'onError' : function(event,ID,fileObj,errorObj){
alert("Error");
}
});
});
function handle(){
$('#uploadify_upload').uploadifyUpload();
}
HTML:
<div>
<input id="uploadify_upload" name="uploadify_upload" type="file" />
</div>
<div>
<input type="submit" value="submit" name="submit" onClick="handle()"/>
</div>
Upvotes: 4
Views: 2228
Reputation: 2638
You should change your script to append the JSESSIONID to the name of the Uploadify SWF, similar to the solution suggested on SO for another SWF Uploader tool.
So, something like this should work (assuming the Javascript you note above is located in a JSP):
$('#uploadify_upload').uploadify({
'uploader' : '../js/uploadify.swf?<%=request.getSession().getId()%>',
If you are not generating this Javascript from a JSP, you'll have to figure out how to get the JSESSIONID to the Javascript that is calling uploadify - you may need to introduce a parameter to the function that wraps uploadify, etc.
Upvotes: 3