When using ajax Uploadify I keep getting a Security Error in my browser
We are using Uploadify to upload images with our website. Currently when I click on Add photo,browse to my photo and select it. The uploadify status bar turns red and throws a message that says:
whatever开发者_如何学C.jpg (size 65.36KB) - Security Error
I have looked at the Apache logs and do not see any errors being thrown. We have reviewed all the image upload directories and the permissions look correct. We also ran FireBug and do not see any errors thrown when this message is thrown.
I have added a crossdomain.xml file in my Apache Document Root and it is accessible with a browser. But I am still not able to get past this error. I have tried a few crossdomain.xml's and this is my current one:
You need crossdomain.xml to establish domain trust. Rather lengthy explanation: http://kb2.adobe.com/cps/142/tn_14213.html
Brief example: http://www.youtube.com/crossdomain.xml
And here's a related SO question.
Solved this problem for myself - no one out there has mentioned this so I hope it helps.
In my script I had the following three arguments:
'uploader' : 'includes/uploadify/scripts/uploadify.swf',
'script' : 'includes/uploadify/scripts/uploadify.php',
'cancelImg' : 'includes/uploadify/cancel.png',
The fix was simple - put a leading slash on the "includes" path:
'uploader' : '/includes/uploadify/scripts/uploadify.swf',
'script' : '/includes/uploadify/scripts/uploadify.php',
'cancelImg' : '/includes/uploadify/cancel.png',
Apparently uploadify thought that without the leading / the swf was on another domain and looked to see if that domain (the domain of "includes") allows for this cross scripting behavior. Adding the leading slash fixed it.
精彩评论