2010-09-27 1 views
0

Я использую django, и у меня есть следующий шаблон для загрузки файлов с использованием SWFUpload sxf object show, загрузка пробуждает шов, чтобы работать, но в то время как индикатор хода не работает на 100% добавьте следующее, нет сообщений, полученных от sever. Кто-нибудь знал, где я ошибаюсь?не может сделать jquery SWFUpload сообщения данных

Отладка: SWF DEBUG: Событие: uploadError: IO Ошибка: Идентификатор файла: SWFUpload_0_0. IO Ошибка: ошибка # 2038 SWF DEBUG: Событие: uploadComplete: цикл загрузки завершен. SWF DEBUG: StartUpload: Первый файл в очереди SWF DEBUG: 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" >&nbsp;</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 &raquo;</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> 

ответ

0

Я не знаю SWFUpload на всех, но вы действительно хотите, чтобы ваши upload_url быть под MEDIA_URL? Конечно, это должно быть где-то, что Django может обработать?