-1

I am quite new to Javascript. I am trying to use the ajaxupload plugin to make an upload work within a form. I figured out how to use the form with the file upload plugin. Now, however the output of the form field just appears as [object Object].

Here's the code

 var text=$('input#text').val();


     onSubmit: function(file, ext){
          if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){ 
                         // extension is not allowed 
          status.text('Only JPG, PNG or GIF files are allowed');
          return false;
         }
         status.text('Uploading...');
         this.setData({'text': text});

1 Answer 1

1

You need to return false always. You did not post the complete code, but something like this

onSubmit: function(file, ext){
  if (ext && /^(jpg|png|jpeg|gif)$/.test(ext)) { // extension is allowed 
    status.text('Uploading...');
    this.setData({'text': text});
  }
  else {
    status.text('Only JPG, PNG or GIF files are allowed');
  }  
  return false;
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.