开发者

Jquery custom file input plugin

This jquery plugin allows you to turn any element into a file input element. http:开发者_如何转开发//plugins.jquery.com/project/custom-file

But to actually upload the file, the only documentation i could found is this:

To upload the chosen file to a server you should then attach the input element to a form element

how can i do that?


I think you need to create an html form and append the input to the form, and if you need to submit, you can do it via a submit button or via $.submit

    # from http://www.daimi.au.dk/~u061768/file-input.html
    <script type="text/javascript">
$(function() {
    $('button').button().add('#foo, a').file().choose(function(e, input) {
        $(input).appendTo('#TheForm').
                         attr('name', 'a-name').
                         attr('id', 'an-id');
    });


});
    </script>
    ...
    <form method="post" enctype="multipart/form-data" id="TheForm" action="/path/in/your/server/">
    <input type="submit" value="send">
    </form>

Anyway this is not the best plugin for submiting the files via ajax.


The uploading itself is not of the scope of this plugin. You should see this with your server side technology.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜