Django: Uploadify 3.1 internal server error after initialization

I am confused why I have error 500 right after initialization of JQuery Uploadify because uploadify tries to request the url that doesn't exist, also tried to set preventCaching: false but didn't help

.../document/1/ doesn't exists and current page url is different

Http data

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

from the above we see that Referer:http://localhost:8000/static/g/plugins/uploadify/uploadify.swf so why uploadify makes additional request I didn't ask it to make?

JS code:

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

What is the problem with uploadify or what am I doing wrong?

Thanks,

Sultan

Answers


It producing error because uploadify upload the file through a upload handler ur which you are setting using

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

Maybe '{% url upload_file object.id %}', is producing something like .../document/1/. You should provide a valid url for this option and in that handler script you have to handle file upload like you do for normal file uploads, like saving uploaded file etc.

Read more on http://www.uploadify.com/documentation/uploadify/uploader/


Been debugging and found that Uploadify looks for button_image_url property, I just nulled and thats it I don't have this error anymore

Uploadify debug trace

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

Thanks for your attention.


Need Your Help

phpmailer - email not send in gmail

php email smtp gmail phpmailer

I am having problem with sending mail using phpmailer. I am a beginner programmer. I am trying to make contact form. My code is as follow(submit.php). Please suggest me.. Thanks in advance .

Upload a .zip file to FTP and unzip it using PHP

php upload ftp zip unzip

I'm trying to make a script that would upload a certain zip file , currently "test.zip", and then unzip it. I found some answers in this website about how to unzip but got no idea how to do it on a...