2012-06-03 67 views
0

後,我很困惑,爲什麼我有錯誤500 JQuery Uploadify因爲uploadify嘗試請求不存在的URL的初始化之後,也試圖設置preventCaching: false,但並沒有幫助Django的:Uploadify 3.1內部服務器錯誤初始化

Error screenshot .../document/1/不存在,當前頁面的URL是不同

HTTP數據

Request URL:http://localhost:8000/document/1/ 
Request Method:GET 
Status Code:500 INTERNAL SERVER ERROR 
Request Headersview source 
Accept:*/* 
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 
Accept-Encoding:gzip,deflate,sdch 
Accept-Language:en-US,en;q=0.8 
Cache-Control:no-cache 
Connection:keep-alive 
Host:localhost:8000 
Pragma:no-cache 
Referer:http://localhost:8000/static/g/plugins/uploadify/uploadify.swf 

從上面我們看到Referer:http://localhost:8000/static/g/plugins/uploadify/uploadify.swf那麼爲什麼uploadify會提出額外的請求我沒有要求它做出來?

JS代碼

$('#id_file').uploadify({ 
    swf: '{% static 'g/plugins/uploadify/uploadify.swf' %}', 
    uploader: '{% url upload_file object.id %}', 
    //... 
}); 

與uploadify有什麼問題或者我究竟做錯了什麼?

感謝,

蘇丹

+0

'500內部服務器錯誤'與JS無關,它是一個服務器錯誤,所以你最好檢查你的後端的錯誤日誌。 –

+0

我想知道爲什麼Uploadify會提出額外請求我沒有要求它做出 – sultan

+0

如果我刪除了uploadify init代碼,我沒有這個額外的請求 – sultan

回答

0

上傳文件等

已經閱讀並調試發現處理文件上傳這Uploadify尋找button_image_url財產,我只是歸零和多數民衆贊成它,我沒有這個錯誤了

Uploadify調試跟蹤

---SWFUpload Instance Info--- 
Version: 2.2.0 2009-03-25 
Movie Name: SWFUpload_0 
Settings: 
    upload_url:    /document/1/add-file 
    flash_url:    /static/g/plugins/uploadify/uploadify.swf 
    use_query_string:   false 
    requeue_on_error:   false 
    http_success:    
    assume_success_timeout: 30 
    file_post_name:   file 
    post_params:    [object Object] 
    file_types:    *.* 
    file_types_description: All Files 
    file_size_limit:   0 
    file_upload_limit:  0 
    file_queue_limit:   999 
    debug:     true 
    prevent_swf_caching:  false 
    button_placeholder_id: id_file 
    button_placeholder:  Not Set 
    button_image_url:   /document/1/ 
    button_width:    120 
    button_height:   30 
    button_text:    
    button_text_style:  color: #000000; font-size: 16pt; 
    button_text_top_padding: 0 
    button_text_left_padding: 0 
    button_action:   -110 
    button_disabled:   false 
    custom_settings:   [object Object] 
Event Handlers: 
    swfupload_loaded_handler assigned: false 
    file_dialog_start_handler assigned: true 
    file_queued_handler assigned:  true 
    file_queue_error_handler assigned: true 
    upload_start_handler assigned:  true 
    upload_progress_handler assigned: true 
    upload_error_handler assigned:  true 
    upload_success_handler assigned: true 
    upload_complete_handler assigned: true 
    debug_handler assigned:    true 

SWF DEBUG: SWFUpload Init Complete 
SWF DEBUG: 
SWF DEBUG: ----- SWF DEBUG OUTPUT ---- 
SWF DEBUG: Build Number:   SWFUPLOAD 2.2.0 
SWF DEBUG: movieName:    SWFUpload_0 
SWF DEBUG: Upload URL:    /document/1/add-file 
SWF DEBUG: File Types String:  *.* 
SWF DEBUG: Parsed File Types:  

感謝您的關注。

0

它產生錯誤,因爲uploadify通過上傳處理​​程序烏爾上傳的文件,你正在使用

uploader: '{% url upload_file object.id %}', 

也許'{% url upload_file object.id %}',設置是生產像.../document/1/。你應該爲這個選項提供一個有效的URL,並在處理程序腳本你有一個像你正常的文件上傳做,就像節省更多http://www.uploadify.com/documentation/uploadify/uploader/