SWFUpload在IE中可用,但不能在Firefox中使用 [英] SWFUpload works in IE, but not in Firefox
问题描述
在我的ASP.NET应用程序中,所有upload.aspx(我在设置对象中设置了正确的upload_url)正在处理上传。在IE 8中,upload.aspx页面的上传被处理,但是在Firefox中却没有。有什么建议么?
用户访问上传文件的大部分代码显示在这里(注意:母版页正在使用):
< script type =text / javascriptsrc =../ swfupload / swfupload.js>< / script>
< script type =text / javascriptsrc =../ js / handlers.js>< / script>
< script type =text / javascript>
var swfu;
window.onload = function(){
swfu = new SWFUpload({
//后端设置$ b $ upload_url:../upload.aspx,
post_params :{
ASPSESSID:<%= Session.SessionID%>
},
//文件上传设置
file_size_limit:10 MB ,
file_types:*。*,
file_types_description:All Files,
file_upload_limit:1,
file_queue_limit:1,
// assume_success_timeout:60 ,
//事件处理程序设置 - 这些函数在Handlers.js中定义
//处理程序不是SWFUpload的一部分,而是我的网站的一部分,控制
/ /我的网站反应到SWFUpload事件
file_queue_error_handler:fileQueueError,
file_dialog_complete_handler:fileDialogComplete,
upload_progress_h andler:uploadProgress,
upload_error_handler:uploadError,$ b $ upload_success_handler:uploadSuccess,$ b $ upload_complete_handler:uploadComplete,
//按钮设置
button_image_url:../ Images / XPButtonNoText_160x22.png,
button_placeholder_id:spanButtonPlaceholder,
button_width:160,
button_height:22,
button_text:'< span class =button>上传档案< span class =buttonSmall>(10 MB Max)< / span>< / span>',
button_text_style:'.button {font-family:Helvetica,Arial,sans-serif; font-size:14pt; } .buttonSmall {font-size:10pt; }',
button_text_top_padding:1,
button_text_left_padding:5,
// Flash设置
flash_url:../swfupload/swfupload.swf,//相对于此文件
custom_settings:{
upload_target:divFileProgressContainer
},
//调试设置
debug:false
});
}
< / script>
请在其他浏览器中尝试,例如Safari或Chrome 。
如果它只在IE中有效,那么可能是Flash Cookie Bug中提到的其他答案。
它适用于除Firefox以外的所有内容,可能是因为没有为进度条定义css。我不知道为什么这会引起一个问题,但是我发现它确实如此。一旦我把样本样式放到我的css文件中,它就开始在Firefox中工作。
我使用的CSS如下所示:
DIV.ProgressBar {width:100px;填充:0;边框:1px纯黑色; margin-right:1em;高度:.75em;保证金左:1EM;显示:-moz-直列堆叠;显示:内联块;缩放:1; *显示:内联; }
DIV.ProgressBar DIV {background-color:Green; font-size:1pt;高度:100%;浮动:左; }
SPAN.asyncUploader OBJECT {position:relative;顶部:5px;左:10px; }
Using SWFUpload v2.2, Firefox 3, IE 8, Flash 10 In my ASP.NET application all uploads are being processed by upload.aspx (I have the correct upload_url set in the settings object). In IE 8 the uploads hit the upload.aspx page and are processed, but in Firefox they do not. Any suggestions?
Most of the code for the page that the user visits to upload a file is shown here (note: master pages are being used):
<script type="text/javascript" src="../swfupload/swfupload.js"></script>
<script type="text/javascript" src="../js/handlers.js"></script>
<script type="text/javascript">
var swfu;
window.onload = function() {
swfu = new SWFUpload({
// Backend Settings
upload_url: "../upload.aspx",
post_params: {
"ASPSESSID": "<%=Session.SessionID %>"
},
// File Upload Settings
file_size_limit: "10 MB",
file_types: "*.*",
file_types_description: "All Files",
file_upload_limit: 1,
file_queue_limit: 1,
//assume_success_timeout: 60,
// Event Handler Settings - these functions as defined in Handlers.js
// The handlers are not part of SWFUpload but are part of my website and control how
// my website reacts to the SWFUpload events.
file_queue_error_handler: fileQueueError,
file_dialog_complete_handler: fileDialogComplete,
upload_progress_handler: uploadProgress,
upload_error_handler: uploadError,
upload_success_handler: uploadSuccess,
upload_complete_handler: uploadComplete,
// Button settings
button_image_url: "../Images/XPButtonNoText_160x22.png",
button_placeholder_id: "spanButtonPlaceholder",
button_width: 160,
button_height: 22,
button_text: '<span class="button">Upload File<span class="buttonSmall">(10 MB Max)</span></span>',
button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
button_text_top_padding: 1,
button_text_left_padding: 5,
// Flash Settings
flash_url: "../swfupload/swfupload.swf", // Relative to this file
custom_settings: {
upload_target: "divFileProgressContainer"
},
// Debug Settings
debug: false
});
}
</script>
Try in another browser too, such as Safari or Chrome.
If it works only in IE, it's probably the Flash Cookie Bug the other answers mention.
If it works in everything except Firefox, it could be that there's no css defined for the progress bar. I don't know why this causes a problem, but I found that it did. As soon as I put the sample styles into my css file, it started working in Firefox.
The css I used is as follows:
DIV.ProgressBar { width: 100px; padding: 0; border: 1px solid black; margin-right: 1em; height:.75em; margin-left:1em; display:-moz-inline-stack; display:inline-block; zoom:1; *display:inline; }
DIV.ProgressBar DIV { background-color: Green; font-size: 1pt; height:100%; float:left; }
SPAN.asyncUploader OBJECT { position: relative; top: 5px; left: 10px; }
这篇关于SWFUpload在IE中可用,但不能在Firefox中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!