0

我很困惑为什么我在初始化后立即出现错误 500,JQuery Uploadify因为uploadify尝试请求不存在的 url,也尝试设置preventCaching: false但没有帮助

错误截图 .../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 有什么问题或者我做错了什么?

谢谢,

苏丹

4

2 回答 2

0

它会产生错误,因为uploadify通过您设置使用的上传处理程序上传文件

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

也许'{% url upload_file object.id %}',正在生产类似.../document/1/. 您应该为此选项提供一个有效的 url,并且在该处理程序脚本中,您必须像处理普通文件上传一样处理文件上传,例如保存上传的文件等。

阅读更多关于http://www.uploadify.com/documentation/uploadify/uploader/

于 2012-06-03T19:21:43.550 回答
0

一直在调试,发现 Uploadify 寻找button_image_url属性,我只是为空,就是这样我不再有这个错误了

上传调试跟踪

---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:      

感谢您的关注。

于 2012-06-03T19:26:21.543 回答