tomitrescak / meteor-uploads

MIT License
295 stars 41 forks source link

How to show uploaded images on Cordova? #182

Closed giggioz closed 8 years ago

giggioz commented 8 years ago

Hi,

The following code is a 'standard' set up for meteor-uploads. It works on desktop while in the Cordova app the uploading part works fine but the image is not shown. Can you address me on this?

Side question : the upload part on the Android Default Browser and Android Chrome Browser does not work... is an expected behaviour? (it shows Failed: 0 error 0 Byte)

if (Meteor.isServer) {
  Meteor.startup(function () {
    UploadServer.init({
      tmpDir: process.env.PWD + '/.uploads/tmp',
      uploadDir: process.env.PWD + '/.uploads/',
      checkCreateDirectories: true, //create the directories for you
      getFileName: function(){
        return 'xxx.jpg';
      },
      overwrite:true
    });
  });
}

if (Meteor.isClient) {

    Meteor.startup(function() {

        Uploader.uploadUrl = Meteor.absoluteUrl('upload'); // Cordova needs absolute URL

    });

}

in template

<template name="show">
    <img src="/upload/xxx.jpg">
</template>
tomitrescak commented 8 years ago

Please check on this forum issues related to Android. There is a bug in the browser that does not like the file control. Not sure where I've seen it but it's there.