question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Camera Images fail to upload on iPhone

See original GitHub issue

Bug Report

Problem

What is expected to happen?

I’m able to successfully upload an image selected from library. I expect to capture an image and successfully upload an image from the camera in the same way as the library selection.

What does actually happen?

When I select camera and upload image from the camera I always get a 500 error. However, the image never makes it to my server so there isn’t an error on the server side.

Information

Command or Code

else if (this.platform.is('ios') && sourceType === this.camera.PictureSourceType.CAMERA) {
                console.log('iPhone camera!');

                var currentName = imagePath.substr(imagePath.lastIndexOf('/') + 1);
                var correctPath = imagePath.substr(0, imagePath.lastIndexOf('/') + 1);
                let fileTransfer: FileTransfer = new FileTransfer()
                let options: FileUploadOptions = {
                    fileKey: 'image',
                    fileName: currentName,
                    chunkedMode: false,
                    headers: {
                        "Application": "MyApp",
                        "Authorization": "Bearer " + localStorage.getItem(StorageKey.AccessToken)
                    }
                }
                fileTransfer.create().upload(normalizeURL(imagePath), encodeURI(this.uploadLink), options, true).then(result => {
                    console.log('File transfer result: ', result);
                }).catch(err => {
                    console.log('Error with file transfer: ', err);
                });
            }

Environment, Platform, Device

iPhone XR iOS: 12.3.1

Version information

Ionic:

Ionic CLI : 5.2.1 (/usr/local/lib/node_modules/ionic) Ionic Framework : ionic-angular 3.9.5 @ionic/app-scripts : 3.2.2

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : ios 5.0.1 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, (and 27 other plugins)

Utility:

cordova-res : not installed native-run : 0.2.7

System:

Android SDK Tools : 26.1.1 (/Users/travis.bradfield/Library/Android/sdk) ios-deploy : 1.9.4 ios-sim : 8.0.1 NodeJS : v10.15.0 (/usr/local/bin/node) npm : 6.9.2 OS : macOS Mojave Xcode : Xcode 10.2.1 Build version 10E1001

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
breautekcommented, Oct 3, 2019

Well in my case I’m not quite sure if it’s an error 500. The backend error logs are empty. My only clue is that from Xcode it returns only INVALID_SERVER_URL.

Then it doesn’t look like it’s related to this issue.

1reaction
breautekcommented, Oct 3, 2019

I am currently experiencing this error with this issue Any fixes for this?

Http status code 500 means Internal Server Error. This means something went wrong on the server. The actual reason is unknown and there should be a server log. You may need to dig through a lot of logs, for example if you have a rest webserver application behind a reverse proxy, well then you’ll likely have two separate log files, one for your backend rest application and one for your reverse proxy. It’s hard to give specific details because this obviously depends on how your servers are configured.

Also to be clear, I’m not saying the server is at fault. The client could be doing something that the server just simply doesn’t expect. But without an actual error message it will be hard to give any recommendations or to provide any solutions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to upload photo - Apple Community
When trying to open a photo on my phone I receive an error that says unable to load photo. There's an exclamation point...
Read more >
13 Ways to fix unable to load photo or video error on iPhone
To fix unable to load photo or video error on iPhone, 1. Check your iPhone storage, 2. Force quit and open Photos, 3....
Read more >
Top 9 Ways to Fix Unable to Load Photo Error on iPhone
Top 9 Ways to Fix Unable to Load Photo Error on iPhone · 1. Restart iPhone · 2. Check Internet Connection · 3....
Read more >
Fix iPhone Photos Unable to load photo/video Issue in 2022
As we mentioned earlier, the most common reason for the error message 'Unable to upload photo or video' is the storage optimization feature...
Read more >
Why can't I upload photos/pictures on my iPhone or iPad?
Why can't I upload photos/pictures on my iPhone or iPad? · Uninstall and reinstall the PNP app, make sure you're on the newest...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found