Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files upload not working on IOS. #458

Closed
IDCOLL opened this issue Jul 5, 2017 · 23 comments
Closed

Files upload not working on IOS. #458

IDCOLL opened this issue Jul 5, 2017 · 23 comments
Labels

Comments

@IDCOLL
Copy link

IDCOLL commented Jul 5, 2017

  • 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.

@dr-dimitru
Copy link
Member

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}

@IDCOLL
Copy link
Author

IDCOLL commented Jul 5, 2017

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?

@dr-dimitru
Copy link
Member

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.

@IDCOLL
Copy link
Author

IDCOLL commented Jul 5, 2017

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

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

@dr-dimitru
Copy link
Member

Hello @IDCOLL ,

Any news on your end? Is it solved?

@IDCOLL
Copy link
Author

IDCOLL commented Jul 18, 2017 via email

@dr-dimitru
Copy link
Member

Hello @IDCOLL ,

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

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

@IDCOLL
Copy link
Author

IDCOLL commented Jul 18, 2017 via email

@dr-dimitru
Copy link
Member

Awesome!

Please, support this project by:

derwok added a commit to 4minitz/4minitz that referenced this issue Jul 20, 2017
@derwok
Copy link
Contributor

derwok commented Jul 21, 2017

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

dr-dimitru added a commit that referenced this issue Jul 22, 2017
 - Exact code splitting, client part of the library reduced for 35%
 - Atmosphere and NPM packages update
 - Compatibility with [email protected]
 - Fix for #458 - Safari can't handle simultaneous WebSockets
connection, and fails to send large data chunks. It's fixed in this
release with detecting if browser is Safari with `ddp` used as
transport. Note is added to FAQ, Should be fixed in Safari 11. Thanks
to @derwok for bringing it in, and @IDCOLL for original issue
 - Fix resumable uploads, now in 90% upload should survive server
reboot and in 98% connection interruption
 - Better file stream management with file descriptor caching - should
reduce RAM and I/O
@dr-dimitru dr-dimitru mentioned this issue Jul 22, 2017
@dr-dimitru
Copy link
Member

Hello @IDCOLL @derwok

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

@IDCOLL
Copy link
Author

IDCOLL commented Jul 27, 2017

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.

@dr-dimitru
Copy link
Member

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?

@IDCOLL
Copy link
Author

IDCOLL commented Jul 28, 2017

Hi,

  1. As mentioned at the beginning of this issue Files upload not working on IOS. #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 Dev #1/3 chunks, dst: image.jpg" loop until the server runs out of CPU capacity and then restarts.

@dr-dimitru
Copy link
Member

@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?

@IDCOLL
Copy link
Author

IDCOLL commented Jul 28, 2017

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

@dr-dimitru
Copy link
Member

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

@dr-dimitru
Copy link
Member

@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

@dr-dimitru
Copy link
Member

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

@advancedsoftwarecanada
Copy link

advancedsoftwarecanada commented Jan 23, 2019

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

@advancedsoftwarecanada
Copy link

advancedsoftwarecanada commented Jan 23, 2019

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.

@advancedsoftwarecanada
Copy link

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

@dr-dimitru
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants