• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
uploading using ajax and uploading class

[quote author="phazei" date="1233844324"]I suppose after you post you stop racking your mind so the solution comes to you… like not disabling the <input type=file> in the preSubmit function without using setTimeout…[/quote]

Can you explain more in details ?
I have the some problem as you had and I'd like to slove it Smile

I have one file to upload and this is my jQuery :

        rules: {
            userfile: {
                  required: true,
                accept: "mov|avi|mpg|flv"
        submitHandler: function(form) {
                target:        '#positive-result',  
                beforeSubmit:  showRequest,
                success:       showResponse  

    function showRequest(formData, jqForm, options) {
        $('#positive-result').html("Upload en cours...");
        var queryString = $.param(formData);
        return true;

    function showResponse(responseText, statusText)  {    
        $('#positive-result').html( 'La video a bien été ajoutée. <a href="&lt;?=base_url()?&gt;admin/videos">Retour à la liste</a>');

Oh, what I was doing wrong was something like
So people couldn't click the button again. That was done in the "beforeSubmit" function. Disabled input fields aren't submitted, so that was my brain fart.

I don't know what's wrong with your code.

Though, if you are only using the jQuery validation plugin, it won't work. You can't specifically upload a file directly through AJAX. Not possible. You can get ajax like functionality with the jQuery form plugin or a number of other ones. The form is actually submitted in a hidden iframe the normal way. But it appears just like ajax.

See Single, Multiple and Multiple array upload library for a very simple jQuery upload example...

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.