FWAJL / FieldWorkManager

FWA MVC
1 stars 5 forks source link

Upload photo information #1250

Open bsaiken opened 9 years ago

bsaiken commented 9 years ago

@damirius You did not aNswer my question from a different Issue, but this would likely be a new Issue anyway.

Is it possible, when we are uploading a photo, to upload the photo information: timestamp and the file name (as it appears on the mobile device)?

gsouvik commented 9 years ago

@rnicholus @bsaiken I was using the scaling feature of the fineuploader library and facing some issues. Let me explain step by step. Following is my fineuploader javascript setup:

      var galleryUploader = new qq.FineUploader({
        element: document.getElementById('my-uploader'),
        template: 'qq-template-gallery',
        request: {
          endpoint: config.rootFolder + 'file/upload',
          inputName: 'file'
        },
        form: {
          element: document.getElementById('document-upload'),
          autoUpload: true
        },
        thumbnails: {
            placeholders: {
                waitingPath: 'placeholders/waiting-generic.png',
                notAvailablePath: 'placeholders/not_available-generic.png'
            }
        },
        validation: {
            allowedExtensions: ['jpeg', 'jpg', 'png']
        },
        scaling: {
          sendOriginal: false,
          includeExif: false,
          sizes: [
            {name: "small", maxSize: 200}
          ]
        }
      });

I've used scaling as well as attached a form with it so that everything works with my already coded end point. I've changed the file input name from qqfile to file so that I do not have to change my end point.

When I debug the _files superglobal on the server end point this is the output I see:

Array
(
    [file] => Array
        (
            [name] => blob
            [type] => image/jpeg
            [tmp_name] => /private/var/tmp/phpbjAFe0
            [error] => 0
            [size] => 9010
        )

)

As you see, the scaled version of the file actually uploads but the original name of the file (which according to fineuploader documentation should have been: "original name" + "small.extension") of the file is not maintained and my end point fails.

Could you please let me know if I'm making any configuration mistake or how I may fix it. Let me know if you need more info on the issue.

Thank You.

rnicholus commented 9 years ago

The name of the scaled file is stored in the qqfilename request parameter.

On Wed, Sep 23, 2015 at 12:44 PM Souvik Ghosh notifications@github.com wrote:

@rnicholus https://github.com/rnicholus @bsaiken https://github.com/bsaiken I was using the scaling feature of the fineuploader library and facing some issues. Let me explain step by step. Following is my fineuploader javascript setup:

  var galleryUploader = new qq.FineUploader({
    element: document.getElementById('my-uploader'),
    template: 'qq-template-gallery',
    request: {
      endpoint: config.rootFolder + 'file/upload',
      inputName: 'file'
    },
    form: {
      element: document.getElementById('document-upload'),
      autoUpload: true
    },
    thumbnails: {
        placeholders: {
            waitingPath: 'placeholders/waiting-generic.png',
            notAvailablePath: 'placeholders/not_available-generic.png'
        }
    },
    validation: {
        allowedExtensions: ['jpeg', 'jpg', 'png']
    },
    scaling: {
      sendOriginal: false,
      includeExif: false,
      sizes: [
        {name: "small", maxSize: 200}
      ]
    }
  });

I've used scaling as well as attached a form with it so that everything works with my already coded end point. I've changed the file input name from qqfile to file so that I do not have to change my end point.

When I debug the _files superglobal on the server end point this is the output I see:

Array( [file] => Array ( [name] => blob [type] => image/jpeg [tmp_name] => /private/var/tmp/phpbjAFe0 [error] => 0 [size] => 9010 ))

As you see, the scaled version of the file actually uploads but the original name of the file (which according to fineuploader documentation should have been: "original name" + "small.extension") of the file is not maintained and my end point fails.

Could you please let me know if I'm making any configuration mistake or how I may fix it. Let me know if you need more info on the issue.

Thank You.

— Reply to this email directly or view it on GitHub https://github.com/FWAJL/FieldWorkManager/issues/1250#issuecomment-142676324 .

gsouvik commented 9 years ago

@rnicholus Is there any Javascript configuration to override it so that it uses file when the original file is not uploaded?

rnicholus commented 9 years ago

No, and in fact this is not possible cross-browser.