无法使 jquery SWFUpload 发布数据
我正在使用 django,并且我有以下模板用于使用 SWFUpload 上传文件 sxf 对象显示,下载程序接缝正在工作,但当进度条达到 100% 时,接下来没有任何附加,服务器没有收到任何发布数据。 有人知道我错在哪里吗?
调试: SWF 调试:事件:uploadError:IO 错误:文件 ID:SWFUpload_0_0。 IO 错误:错误 #2038 SWF DEBUG:事件:uploadComplete:上传周期完成。 SWF 调试:开始上传:队列中的第一个文件 SWF 调试:StartUpload():队列中未找到文件。
模板:
<!DOCTYPE html PUBLIC "-//W3C//DTD html 5.0 Strict//FR" "http://www.w3.org/TR/html5/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
{% load facebook_tags %}
<head>
{% facebook_js %}
{% initialize_facebook_connect %}
<title>{{ titre }}</title>
<link href="{{ MEDIA_URL }}css/admin.css" rel="stylesheet" type="text/css" />
<script src="{{ MEDIA_URL }}js/jquery.tools.min.js" type="text/javascript"></script>
<script src="{{ MEDIA_URL }}js/jquery.swfupload.js" type="text/javascript"></script>
<script src="{{ MEDIA_URL }}js/swfupload.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#accordion").tabs("#accordion span", {
tabs: 'img',
effect: 'horizontal'
});
});
$(function(){
$('#swfupload-control').swfupload({
upload_url: "{{ MEDIA_URL }}upload/",
file_post_name: 'uploadPanneau',
file_size_limit : "1024",
file_types : "*.jpg;*.png;*.gif",
file_types_description : "Image files",
file_upload_limit : 5,
flash_url : "{{ MEDIA_URL }}swf/swfupload.swf",
button_image_url : '{{ MEDIA_URL }}images/site/wdp_buttons_upload_114x29.png',
button_width : 114,
button_height : 29,
button_placeholder : $('#button')[0],
debug: false
})
.bind('fileQueued', function(event, file){
var listitem='<li id="'+file.id+'" >'+
'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+
'<div class="progressbar" ><div class="progress" ></div></div>'+
'<p class="status" >En Attente</p>'+
'<span class="cancel" > </span>'+
'</li>';
$('#log').append(listitem);
$('li#'+file.id+' .cancel').bind('click', function(){ //Remove from queue on cancel click
var swfu = $.swfupload.getInstance('#swfupload-control');
swfu.cancelUpload(file.id);
$('li#'+file.id).slideUp('fast');
});
// start the upload since it's queued
$(this).swfupload('startUpload');
})
.bind('fileQueueError', function(event, file, errorCode, message){
alert('La taille du fichier '+file.name+' est plus grande que la limite');
})
.bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
$('#queuestatus').text('Fichier sélectioner: '+numFilesSelected+' / Fichier en Attente: '+numFilesQueued);
})
.bind('uploadStart', function(event, file){
$('#log li#'+file.id).find('p.status').text('Upload en Cours...');
$('#log li#'+file.id).find('span.progressvalue').text('0%');
$('#log li#'+file.id).find('span.cancel').hide();
})
.bind('uploadProgress', function(event, file, bytesLoaded){
//Show Progress
var percentage=Math.round((bytesLoaded/file.size)*100);
$('#log li#'+file.id).find('div.progress').css('width', percentage+'%');
$('#log li#'+file.id).find('span.progressvalue').text(percentage+'%');
})
.bind('uploadSuccess', function(event, file, serverData){
var item=$('#log li#'+file.id);
item.find('div.progress').css('width', '100%');
item.find('span.progressvalue').text('100%');
var pathtofile='<a href="uploads/'+file.name+'" target="_blank" >view »</a>';
item.addClass('success').find('p.status').html('Fini!!! | '+pathtofile);
})
.bind('uploadComplete', function(event, file){
// upload has completed, try the next one in the queue
$(this).swfupload('startUpload');
})
});
</script>
</head>
<body>
{% facebook_js %}
<div class="second-body">
<div id="accordion">
<!-- 1st header and pane -->
<img src="http://www.sportmag.fr/media/images/site/panneau-avant-admin.png" />
<span style="width:800px; display:block;">
<div id="swfupload-control">
<p>Envoie d'images</p>
<input type="button" id="button" />
<p id="queuestatus" ></p>
<ol id="log"></ol>
</div>
</span>
<!-- 2nd header and pane -->
<img src="http://www.sportmag.fr/media/images/site/gestion-articles-admin.png" />
<span> les articles</span>
<!-- 3rd header and pane -->
<img src="http://www.sportmag.fr/media/images/site/redaction-article-admin.png" />
<span> autres</span>
</div>
</div>
{% initialize_facebook_connect %}
</body>
</html>
i'm using django and i've the following template for uploading files using SWFUpload
the sxf object show, the download prosses seam to be working but wen the progress bar reatch 100% nothing append next, there is no post data receved by the sever.
did someone know where i'm wrong?
debug:
SWF DEBUG: Event: uploadError : IO Error : File ID: SWFUpload_0_0. IO Error: Error #2038
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: StartUpload(): No files found in the queue.
template:
<!DOCTYPE html PUBLIC "-//W3C//DTD html 5.0 Strict//FR" "http://www.w3.org/TR/html5/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="http://www.facebook.com/2008/fbml">
{% load facebook_tags %}
<head>
{% facebook_js %}
{% initialize_facebook_connect %}
<title>{{ titre }}</title>
<link href="{{ MEDIA_URL }}css/admin.css" rel="stylesheet" type="text/css" />
<script src="{{ MEDIA_URL }}js/jquery.tools.min.js" type="text/javascript"></script>
<script src="{{ MEDIA_URL }}js/jquery.swfupload.js" type="text/javascript"></script>
<script src="{{ MEDIA_URL }}js/swfupload.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#accordion").tabs("#accordion span", {
tabs: 'img',
effect: 'horizontal'
});
});
$(function(){
$('#swfupload-control').swfupload({
upload_url: "{{ MEDIA_URL }}upload/",
file_post_name: 'uploadPanneau',
file_size_limit : "1024",
file_types : "*.jpg;*.png;*.gif",
file_types_description : "Image files",
file_upload_limit : 5,
flash_url : "{{ MEDIA_URL }}swf/swfupload.swf",
button_image_url : '{{ MEDIA_URL }}images/site/wdp_buttons_upload_114x29.png',
button_width : 114,
button_height : 29,
button_placeholder : $('#button')[0],
debug: false
})
.bind('fileQueued', function(event, file){
var listitem='<li id="'+file.id+'" >'+
'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+
'<div class="progressbar" ><div class="progress" ></div></div>'+
'<p class="status" >En Attente</p>'+
'<span class="cancel" > </span>'+
'</li>';
$('#log').append(listitem);
$('li#'+file.id+' .cancel').bind('click', function(){ //Remove from queue on cancel click
var swfu = $.swfupload.getInstance('#swfupload-control');
swfu.cancelUpload(file.id);
$('li#'+file.id).slideUp('fast');
});
// start the upload since it's queued
$(this).swfupload('startUpload');
})
.bind('fileQueueError', function(event, file, errorCode, message){
alert('La taille du fichier '+file.name+' est plus grande que la limite');
})
.bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
$('#queuestatus').text('Fichier sélectioner: '+numFilesSelected+' / Fichier en Attente: '+numFilesQueued);
})
.bind('uploadStart', function(event, file){
$('#log li#'+file.id).find('p.status').text('Upload en Cours...');
$('#log li#'+file.id).find('span.progressvalue').text('0%');
$('#log li#'+file.id).find('span.cancel').hide();
})
.bind('uploadProgress', function(event, file, bytesLoaded){
//Show Progress
var percentage=Math.round((bytesLoaded/file.size)*100);
$('#log li#'+file.id).find('div.progress').css('width', percentage+'%');
$('#log li#'+file.id).find('span.progressvalue').text(percentage+'%');
})
.bind('uploadSuccess', function(event, file, serverData){
var item=$('#log li#'+file.id);
item.find('div.progress').css('width', '100%');
item.find('span.progressvalue').text('100%');
var pathtofile='<a href="uploads/'+file.name+'" target="_blank" >view »</a>';
item.addClass('success').find('p.status').html('Fini!!! | '+pathtofile);
})
.bind('uploadComplete', function(event, file){
// upload has completed, try the next one in the queue
$(this).swfupload('startUpload');
})
});
</script>
</head>
<body>
{% facebook_js %}
<div class="second-body">
<div id="accordion">
<!-- 1st header and pane -->
<img src="http://www.sportmag.fr/media/images/site/panneau-avant-admin.png" />
<span style="width:800px; display:block;">
<div id="swfupload-control">
<p>Envoie d'images</p>
<input type="button" id="button" />
<p id="queuestatus" ></p>
<ol id="log"></ol>
</div>
</span>
<!-- 2nd header and pane -->
<img src="http://www.sportmag.fr/media/images/site/gestion-articles-admin.png" />
<span> les articles</span>
<!-- 3rd header and pane -->
<img src="http://www.sportmag.fr/media/images/site/redaction-article-admin.png" />
<span> autres</span>
</div>
</div>
{% initialize_facebook_connect %}
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我根本不了解 swfupload,但您真的希望您的
upload_url
位于MEDIA_URL
下吗?它肯定应该在 Django 可以处理的地方吗?I don't know swfupload at all, but do you really want your
upload_url
to be underMEDIA_URL
? Surely it should be somewhere that Django can process it?