2011-04-29 4 views
2

mvc2에서 plupload를 사용하려고하지만 파일 브라우저 창이 열리지 않습니다.Plupload Filebrowser가 열리지 않습니다

내 코드 :

<script type="text/javascript"> 

// Convert divs to queue widgets when the DOM is ready 
$(function() { 
    $("#uploader").pluploadQueue({ 
     // General settings 
     runtimes: 'gears,flash,silverlight,browserplus,html5', 
     url: '<%: Url.Content("~//Uploades/Horses/") %>', 
     max_file_size: '10mb', 
     chunk_size: '1mb', 
     unique_names: true, 

     // Resize images on clientside if we can 
     resize: { width: 320, height: 240, quality: 90 }, 

     // Specify what files to browse for 
     filters: [ 
     { title: "Image files", extensions: "jpg,gif,png" }, 
     { title: "Zip files", extensions: "zip" } 
    ], 

     // Flash settings 
     flash_swf_url: '../../../../Scripts/plupload/plupload.flash.swf', 

     // Silverlight settings 
     silverlight_xap_url: '../../../../Scripts/plupload/plupload.silverlight.xap' 
    }); 

    // Client side form validation 
    $('form').submit(function (e) { 
     var uploader = $('#uploader').pluploadQueue(); 
     uploader.refresh(); 
     // Validate number of uploaded files 
     if (uploader.total.uploaded == 0) { 
      // Files in queue upload them first 
      if (uploader.files.length > 0) { 
       // When all files are uploaded submit form 
       uploader.bind('UploadProgress', function() { 
        if (uploader.total.uploaded == uploader.files.length) 
         $('form').submit(); 
       }); 

       uploader.start(); 
      } else 
       alert('You must at least upload one file.'); 

      e.preventDefault(); 
     } 
    }); 
}); 

<div id="uploader" style="height:300px"> 
     <p>You browser doesn't have Flash, Silverlight, Gears, BrowserPlus or HTML5 support.</p> 
    </div> 

나는 uploadingelemt이 showen에 밖으로 문제입니다 디버깅하려고합니다. 하지만 파일 추가를 클릭하면 창은 내 페이지 상단으로 점프되며 그 밖의 일은 발생하지 않습니다.

방화 광은 아무런 문제를 나타내지 않습니다.

나는 플래시 및 실버

어떤 하나의 아이디어를 사용하여 IE 8 FF4 &에 시도했습니다? 대단히 감사 드리며 즐거운 주말을 보내시기 바랍니다!

+2

나는 똑같은 것을 얻었지만 아직 해결책을 찾지 못했습니다. – balupton

+0

flash_swf_url : 속성에도 '<% : Url.Content ("~ ~ Uploades/Horses /") %>'URL에 대해 동일한 작업을 수행하십시오. 문제를 해결할 수는 없지만 경로가 올바른지 확인하십시오. 내가 겪은 가장 큰 문제는 경로가 깨져 있다는 것입니다. –

+0

관련 js 종속성을 모두 추가 했습니까? 특정 런타임, 즉 html5 또는 html 4로 시도 했습니까? – Forer

답변

3

브라우저는 'html5'이전에 나열된대로 Flash 런타임을 사용합니다. 플래시 런타임에 'container : "my_uploader_container_id"'설정이 필요합니다.

'pickfiles'버튼을 ID가 'my_uploader_container_id'인 DIV에 배치해야합니다.

또 다른 솔루션은 html5 엔진을 사용하고 있습니다. 'runtimes'매개 변수로 플래시하기 전에 나열하십시오. 하지만 html5 런타임 IE에서 작동하지 않습니다.

+0

이것은 나를 위해 일했습니다. 그것은 문서에서 명확하지 않다 - 그러나 이것은 작동한다. :) – shane

관련 문제