尽管同源政策仍然存在 Flash/Javascript 上传
是否可以将文件上传到脚本来源域以外的域?
例如,假设您在 www.example.com
上托管文件,并且想要将文件上传到 uploads.example.com
,以下脚本是否会违反相同的规定来源策略(使用 uploadify):
<!-- from http://www.example.com/upload.html -->
<input id="fileInput" name="fileInput" type="file" />
<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader' : 'uploadify.swf',
'script' : 'http://upload.example.com/uploadify.php',
'cancelImg' : 'cancel.png',
'auto' : true,
'folder' : '/uploads'
});
});
// ]]></script>
我还没有看到关于同源策略的明确参考来表明-方式或其他这是否会成为任何浏览器的问题。
Can one upload files to a domain other than the domain a script originates from?
For example, suppose you're hosting files on www.example.com
, and you want to upload files to uploads.example.com
, would the following script violate the same origin policy (using uploadify):
<!-- from http://www.example.com/upload.html -->
<input id="fileInput" name="fileInput" type="file" />
<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader' : 'uploadify.swf',
'script' : 'http://upload.example.com/uploadify.php',
'cancelImg' : 'cancel.png',
'auto' : true,
'folder' : '/uploads'
});
});
// ]]></script>
I haven't seen a clear reference on the same origin policy that would indicate one-way or the other whether the this would be an issue with any browsers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不是 Flash 专家,但我认为您需要为此设置一个
crossdomain.xml
文件,如 此处。I'm no Flash expert, but I think you would need to set up a
crossdomain.xml
file for that as described here.