DiscoverGrunt / grunt-http-upload

Grunt plugin to upload files through POST/PUT HTTP request
MIT License
5 stars 8 forks source link

Use case to support multiple files per target #10

Open gregor opened 9 years ago

gregor commented 9 years ago

grunt-http-upload looks like a promising upload solution. I wanted to use it with RayGun to upload map- and js-files. They have an API endpoint which is documented here: https://raygun.io/docs/workflow/source-maps The one file per target totally limits this use case currently.

julienma commented 9 years ago

It seems restler handles multiple files upload, so there's probably a way to make it work in grunt-http-upload.

Considering that uploading a file is just a matter of adding a new field in the data array, I think we could replace the static fields in grunt task

      src: '<%= yeoman.dist %>/dist.zip',
      dest: 'myField'

with a new files object which could then handle multiple files:

        files: {
          'myField': '<%= yeoman.dist %>/dist.zip',
          'myOtherField': 'script.js'
        },

If files is empty or undefined, then we could fall back to the current src and dest fields, so it won't break current implementation.

@gregor WDYT? Fancy trying and proposing a PR?

wthomsen commented 9 years ago

For others stumbling upon this issue for the Raygun source map use case, consider https://github.com/clubdesign/grunt-raygun-sourcemaps