applechief
applechief

Reputation: 6915

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?

Upvotes: 1

Views: 4650

Answers (2)

sacabuche
sacabuche

Reputation: 2849

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.

Upvotes: 4

bluefoot
bluefoot

Reputation: 10580

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

Upvotes: 0

Related Questions