1 Reply Latest reply on Oct 31, 2017 2:17 AM by silen67

    Bug iOS Library "under" my app

    silen67 Level 1

      Hello, first sorry for my vocabulary I do not speak English well.

      I made a hybrid application with phonegap in Html / CSS / JS / PHP, everything works to perfection, even geolocation. Works like a charm on iOS and Android.

      All but one point! This point makes me totally crazy !!! I spent more than 20 hours trying to solve it and I can not ...

      I explain, I have a simple page to send a picture (avatar), when you click on a button, I go to the library, we choose the photo and send it. Nothing crazy.

      On Android it works great. I can pick picture on library and perfectly upload it on my server.


      On iOS it's very weird, I click on the button nothing happens, on the other hand if I go back on the desktop of my iphone and if I went back to the app (without closing it) I arrive directly on the page of the library...! It's like the library opens in the background of the application.

      If anyone could help me this would be fantastic because I'm getting a little crazy ... I do not use ionic or command line, I'm 100% handmade, thank you in advance.




      Here my code (onClick) :


      function getAvatar(source) {
      navigator.camera.getPicture(uploadAvatar, onFail, { quality: 50, destinationType: navigator.camera.DestinationType.FILE_URI, sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY });
      function uploadAvatar(imageURI) {
      var options = new FileUploadOptions();
      options.fileKey = "file";
      var imagefilename = localStorage.getItem("userID") + '-' + Number(new Date()) + ".jpg";
      options.mimeType = "image/jpg";
      var params = new Object();
      params.fileName = imagefilename;
      params.imageURI = imageURI;
      options.params = params;
      options.chunkedMode = false;
      var ft = new FileTransfer();
      var url = URLPHP + "uploadAvatar.php";
      ft.upload(imageURI, url, win, fail, options, true);
      $('#my_picture').val('Photo de profil ajoutée !');


      And PHP


      $new_image_name = $_POST["fileName"];
      move_uploaded_file($_FILES["file"]["tmp_name"], "./Design/Utilisateurs/".$new_image_name);