开发者

can't make jquery SWFUpload post data

开发者 https://www.devze.com 2023-01-17 23:20 出处:网络
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

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.开发者_C百科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>


I don't know swfupload at all, but do you really want your upload_url to be under MEDIA_URL? Surely it should be somewhere that Django can process it?

0

精彩评论

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