2012-06-03 43 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/