search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Upload file on creating new event

Asked by Koen
4 years ago.

I would like to upload a file when creating new events. Somehow it does not seem possible to pass the file-data over the submit function from daypilot. See html code and screenshot from the current result. Is daypilot limiting the content sent by the submit function?

Answer posted by Dan Letecky [DayPilot]
4 years ago.

You can see that the form submission is intercepted and sent using a special $.post() request:

$("#f").submit(function () {
    var f = $("#f");
    $.post(f.attr("action"), f.serialize(), function (result) {
        close(eval(result));
    });
    return false;
});

You'll have to use FormData and $.ajax() in order to submit the data including the file.

See also:
https://stackoverflow.com/questions/21214608/jquery-ajax-single-file-upload

You might need to play with this snippet a little bit - as far as I can see the accepted answer uses this:

var fd = new FormData($("#fileinfo"));

which needs to be replaced with

var fd = new FormData($("#fileinfo")[0]);
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.