开发者

Cross-domain issue. File Uploading & Adobe Flash

I know this problem has been asked ad nauseam; however, it would appear I'm stuck. I have created a file-uploader in Flash which has been successfully tested on a local machine. 开发者_如何学PythonHowever, when moving it to the production server and trying to access it from another machine, the php isn't being called. Initially there were security exceptions being thrown but they've been resolved after creating the crossdomain.xml file.

I've placed some logging in the php file to see if it's called and no dice. It's called if run locally but like I said, cross-domain not so much.

My crossdomain.xml file looks like this as follows.

<?xml version="1.0"?>
<cross-domain-policy>
    <allow-access-from domain="*" />
</cross-domain-policy>

Is there something else I need to do in the configuration of either the Flash or on the server?


you could try the new crossdomain format:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <site-control permitted-cross-domain-policies="all"/>

  <!-- Place top level domain name -->
  <allow-access-from domain="*" />
  <allow-access-from domain="*" to-ports="80,443"/>
  <allow-http-request-headers-from domain="*" headers="*" />

</cross-domain-policy>


I am not fimiliar with flash, but I am developing some flex application, so I can give you my experience to deal with the crossdomain issue.

FlashPlayer is looking for the crossdomain.xml file in the URL domain root, e.g.

domain.com/crossdomain.xml

is where the FlashPlayer wants to find it. Therefore, you can load the crossdomain file by typing the above url.

However, you can use Security.loadPolicyFile(url) to load a crossdomain.xml file from an alternate location on the server.

You can try the following crossdomain.xml:

<?xml version="1.0"?> 
<!DOCTYPE cross-domain-policy SYSTEM “/xml/dtds/cross-domain-policy.dtd”>
<cross-domain-policy> 
<site-control permitted-cross-domain-policies="all"/> 
<allow-access-from domain="*" to-ports="*" secure="false"/> 
<allow-http-request-headers-from domain="*" headers="*" secure="false"/> 
</cross-domain-policy> 

This file means no restricition to anything, so this is good for trouble shooting but not suitable in production.

In addition, you should check your code to see whether you have already changed the url from localhost to your domain name in your flash file.

Sometimes, crossdomain issue is not related to crossdomain file.

For example: Have you chmod the directory on your server to 777 for file uploading.

You can refer to my answer in the following question: flex actionscript not uploading file to PHP page HELP!

You should give us some flash and php coding and also error message that you have received. Otherwise, your question is too general.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜