Django:Uploadify 3.1初始化后发生内部服务器错误

2024-03-29 05:04:21 发布

您现在位置:Python中文网/ 问答频道 /正文

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

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代码

^{pr2}$

上传有什么问题,或者我做错了什么?在

谢谢

苏丹


Tags: nolocalhosthttpurlcacherequestpluginsstatic
2条回答

它产生错误是因为uploadify通过正在使用的上载处理程序ur上载文件

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

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

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

一直在调试,发现Uploadify查找button_image_url属性,我刚刚为null,就这样我再也没有这个错误了

上传调试跟踪

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

谢谢你的关注。在

相关问题 更多 >