mercredi 25 janvier 2017

Ember file upload while clicking button

I am facing 2-issues while working on file-upload using Ember 2.5.0.

I using Ember-plupload for file uploading. I can able to upload the file but the upload is happening whenever i drag and drop the file, My requirement is,I am having a form and file upload which will let user to select or drag the required file and fill the sufficient information after that user will click the "Import" button.While clicking the import button only i have to upload the file and other informations.

Issue 2: Is it possible to send request parameters via URL instead of appending in the URL ?

index.hbs


<div class="dropzone" id= style="width: 80%; height: 100px; border: 2px dashed gray; padding: 0 20px">

  
      Drop to upload
  
      Invalid
  

    Uploading  files. (%)

    <h4>Upload Images</h4>
    <p>
      
          Drag and drop images onto this area to upload them or
      
        <a id="upload-image">Add an Image.</a>
    </p>

</div>
    

Route.js

uploadImage: function (file) {
  file.upload('/api/v1/book/import').then(function (response) {
      console.log("response",response);
      //set(image, 'url', response.headers.Location);
      //return image.save();
    }, function (err) {
      console.log("error",err);
      //image.rollback();
    });
  }

Your help should be appreciated.




Aucun commentaire:

Enregistrer un commentaire