Uploading Images Android

Uploading Images etc Works fine in the Editor and in Windows Builds but not on android, if i upload an image from android it comes out as Empty, But if i upload from Windows or Editor, it works just fine

 if (Application.isEditor)
            {
                Debug.Log("Here Editor");
                NativeFilePicker.PickFile(ImportModel, allowedfiles);         
            }
            else if(SystemInfo.deviceType == DeviceType.Handheld)
            {
                Debug.Log("Here Phone");
                NativeFilePicker.PickFile(ImportModel, allowedfiles);
            }
            else if(SystemInfo.deviceType == DeviceType.Desktop)
            {
                Debug.Log("HereDesktop");
                FileBrowser.ShowLoadDialog(ImportModel_Win, OnCancel, FileBrowser.PickMode.Files, false);

 private void ImportModel_Win(string[] paths)
        {
            foreach (var item in paths)
            {
                Debug.Log(item);
            }
            ImportModel(paths[0]);
        }
        public void ImportModel(string thePath)
        {
            if (thePath == "" || thePath == null) return;
            Sprite sprite = IMG2Sprite.LoadNewSprite(thePath);
            if (sprite)
            {
                //Creat a new img
                getImageUI.Success_AddAttachment(sprite);
                Upload_AttachmentSuccessfully(sprite, thePath);
            }
        }
            }
 public virtual IEnumerator UploadMultipleFiles(long ticketID, string type)
        {

            sendingFiles = true;
            UnityWebRequest[] files = new UnityWebRequest[getAllAttachmentLocalPaths.Get_Attachments.Count];
       
            WWWForm form = new WWWForm();

            UnityWebRequest req = new UnityWebRequest();
       

            for (int i = 0; i < files.Length; i++)
            {

                files[i] = UnityWebRequest.Get(getAllAttachmentLocalPaths.Get_Attachments[i]);



                yield return files[i].SendWebRequest();
                form = new WWWForm();

                form.AddField("UnityIdentifier", OnSelectedItem.Instance.CurrentIdClicked);
                form.AddField("TicketId", ticketID.ToString());
                form.AddField("Type", type );
                form.AddField("ProjectFileId", OnServer.Instance.CurrentProjectLoaded.ProjectFileId.ToString());
                form.AddBinaryData("File", files[i].downloadHandler.data, Path.GetFileName(getAllAttachmentLocalPaths.Get_Attachments[i]));

            
                req = UnityWebRequest.Post("post IP", form);
                if (AddToken() != null)
                {
                    req.SetRequestHeader("Authorization", "Bearer " + AddToken());
                }
                yield return req.SendWebRequest();
            }

            if (req.responseCode == 200)
            {
                sendingFiles = false;
                Debug.Log("Uploaded " + files.Length + " files Successfully");

            }
            else
            {
                Debug.Log(req.error);
            }



        }

Does anyone know how to fix it ?

Find out if it’s not reading the file properly or not uploading it properly.

If the former, google up on how to get that working.

If it’s the latter, here is how to debug network stuff:

Networking, UnityWebRequest, WWW, Postman, curl, WebAPI, etc:

And setting up a proxy can be very helpful too, in order to compare traffic:

i checked the Path and its sending the right path /storage/emulated/0/DCIM/Camera/20211004_122430.jpg

But on the database im receiving an empty Image

I also checked the bytes that should be sent on android the data is empty but on windows it has the data in it
i was also able to find those 2 errors

10-06 11:01:59.146  7806 10424 W Unity   : AndroidVideoMedia: Error opening extractor: -10002
10-06 11:01:59.146  7806 10424 W Unity   :
10-06 11:01:59.152  7806 10422 E Unity   : Curl error 7: Failed to connect to localhost port 80: Connection refused