开发者

Jquery custom file input plugin

开发者 https://www.devze.com 2023-03-23 16:47 出处:网络
This jquery plugin allows you to turn any element into a file input element. http:开发者_如何转开发//plugins.jquery.com/project/custom-file

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

精彩评论

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

关注公众号