veliovgroup / Meteor-Files

🚀 Upload files via DDP or HTTP to ☄️ Meteor server FS, AWS, GridFS, DropBox or Google Drive. Fast, secure and robust.

Home Page:https://packosphere.com/ostrio/files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Files upload not working on IOS.

IDCOLL opened this issue · comments

  • Meteor 1.3.5.1
  • Meteor-Files v1.8.0 , added via Meteor Add ostrio:files
  • Server Side Issue

I have Meteor-Files uploading images via my Webapp to Dropbox. The solution seems to work on my Windows Laptop (Chrome, Mozilla) browsers. On mobile devices that is Android based it uploads to Dropbox.

It will however not upload from my iphone (Guessing IOS related?). Is there a know issue for IOS devices. When I go to the files.veliov.com site and I try to upload from the same IOS device it will also not start.

The server log gets stuck on the following line:
---[Upload] [DDP] Got #1/1 chunks, dst: image.jpg

My code for uploading,**client side**:
              var uploadInstance = Images.insert({
                file: file,
                streams: 'dynamic',
                chunkSize: 'dynamic'
              }, false);
              uploadInstance.on('start', function() {
                      this.currentUploadvar = 1;
                      console.log(this.currentUploadvar);
                     });
              uploadInstance.on('end', function(error, fileObj) {
                  if (error) {
                      alert('Error during upload: ' + error.reason);
                      } else {
                      alert('File "' + fileObj.name + '" successfully uploaded');
                              }
                      // console.log('Upload Ended');
                      //  this.currentUpload.set(false);
                      this.currentUploadvar = 0;
                      });

              uploadInstance.start();

Server side code,
Basically the same as the Dropbox upload tutorial.

Any assistance would be greatly appreciated.

Hello @IDCOLL

  1. Haven't tested this package on such old Meteor, is there a reason why you're not updating?
  2. Try to play with streams and chunkSize, start with: {streams: 1, chunkSize: 102400}

Thank you for the quick response,

  1. I havent upgraded due to some core packages that I use still doesnt easily work since Meteor 1.4. But I know I have to...
  2. I will play around with the streams a bit.

Just 1 question, when I go to your demo site, https://files.veliov.com/ i can also not upload fotos from my iphone. Should your demo site work with all devices?

There is old version of the package, where is DDP on iPhone was broken. Don't have time to update this demo.
Click on "gear" icon and select "HTTP" as uploading transport.
You may also set transport to HTTP in your code.

Okay great. the upload on your demo site works when switching to HTTP.

Now to try and get it working on my app...

Hello @IDCOLL ,

Any news on your end? Is it solved?

Hello @IDCOLL ,

Sure see transport in the .insert() method docs.

FilesCollection#insert({
  file: e.currentTarget.files[0],
  transport: 'http'
});

Awesome!

Please, support this project by:

With ostrio:files (Meteor-Files) 1.8.0 we also had this problem, that iOS devices sometimes could not upload at all, sometimes simply the progressbar stuck at 0%, then after "some time" (>10 Secs) the Upload was nevertheless successfully done.
We are on Meteor 1.5.1.
For us the solution was streams: 1inside FilesCollection.insert(), so we still use DDP.
see: 4minitz/4minitz@ff8f0e2

Hello @IDCOLL @derwok

This should be fixed in the library itself in v1.8.1, let me know if it works for you

Hi @dr-dimitru,
I updated to Meteor 1.5, upgrade to v1.8.1 but my iphone issue is still present.
Exactly the same result as previously.

Current Dev setup:
Meteor 1.5.1
ostrio:files (Meteor-Files) 1.8.1
OS Linux 16.04

I have stopped all apple uploads on my app, and moved back to DDP uploads. the HTTP uploads failed to many times.

Below are the logs for my attempt to upload.
[......][FilesCollection] [find(undefined, undefined)]
[.......][FilesCollection] [find(undefined, undefined)]
[.......][FilesCollection] [Upload] [DDP] Got #1/3 chunks, dst: image.jpg
[.......][FilesCollection] [find(undefined, undefined)]
[.......][FilesCollection] [find(undefined, undefined)]
[........][FilesCollection] [find(undefined, undefined)]
[..........][FilesCollection] [Upload] [DDP] Got #1/3 chunks, dst: image.jpg
[..........][FilesCollection] [Upload] [DDP] Got #1/3 chunks, dst: image.jpg
[........][FilesCollection] [find(undefined, undefined)]

What is interesting, this loop that the server gets stuck on, crashes the server.
Tried streams : 1 as well, still no success.

Hello @IDCOLL ,

  1. Was it working before the update? If yes, - what Meteor and Meteor-Files versions you were on?
  2. Any client errors?
  3. With what exception server is crashing?

Hi,

  1. As mentioned at the beginning of this issue #458, I experienced this issue using

Meteor 1.3.5.1
Meteor-Files v1.6.1 , added via Meteor Add ostrio:files //Wrongly quoted 1.8.0 on my initial quote

I then moved to use http tranfer method, which worked for the apple devices but it made uploads difficult for other devices.

  1. The client doesnt receive an error, the upload just doesnt progress at all.

  2. The server doesn`t crash with an error, it just keeps on going through the "[FilesCollection] [Upload] [DDP] Got #1/3 chunks, dst: image.jpg" loop until the server runs out of CPU capacity and then restarts.

@IDCOLL

v1.6.1 is a way too old. I can not guarantee it should work. Many bugs was fixed since its release.
Are you able to upgrade?

I understand. That is why I upgraded to v1.8.1

@IDCOLL is issue appears on development and prod, or only prod?

@IDCOLL and Client log you've posted looks like, connection was interrupted, then established again, and upload resumed with not sent chunk, which is #1

Well actually it's Server logs.... anyways could you please post fresh Server and Client debug logs?

Issue is not solved... the big problem right now is that if an image is selected and it is on iCloud... it's almost like the file changes. I keep getting a DDP -1/28 in the uploader log.

Nothing happens.

Try the file again, it uploads as expected.

Trying some client side hacks now to solve...

[FilesCollection] [Upload] [DDP Start Method] Got #-1/10 chunks, dst: D5FEF0CA-D322-460C-8795-AF5CA11B914D.jpeg

The result on server is the file is a 0kb text file?

image

In order to get this working on iOS I've had to wrap my uploader in a timeout:

setTimeout(function(){ upload.start(); },2000);
Two seconds seems to work.

I feel like the iOS app for file management is slow to release the file. You select it, and it does some sort of extra process -- yet your application is sent the signal of file received. As shown above this is not the case, it is 0kb and a text file -- it's blank.

Perhaps more research can go in to the iOS photos API or something to discover the true source of this bug and ACTUALLY resolve it. Maybe building some more code to say "Wait for actual iOS photo to enter the FILE system.

We could examine the Cloudinary uploader system, I have another system running that for media and it's working perfectly on iOS.

@dr-dimitru Just a friendly tag to come and revisit an interesting find :)

Hello @AndyNormore ,

Thank you for reporting about this, is this issue still a case?
If so, have you got any insights from Cloudinary uploader?

//cc @jankapunkt