Upload a file to QB Online

Upload a file to QB Online C#.NET Code

Upload a file to QB Online C#.NET Code
                    
DataService.DataService commonServiceQBO= new DataService.DataService(qboContextoAuth);
      string imagePath = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "\\", "Services\\Resource\\image.jpg");
                        System.IO.FileInfo file = new System.IO.FileInfo(imagePath);
                        Attachable attachable = new Attachable();
                        attachable.AttachableRef = new AttachableRef[1];
                        attachable.AttachableRef[0].EntityRef = new ReferenceType();
                        attachable.AttachableRef[0].EntityRef.type = "Bill";
                        attachable.AttachableRef[0].EntityRef.Value = "12";
                        attachable.Lat = "25.293112341223";
                        attachable.Long = "-21.3253249834";
                        attachable.PlaceName = "Fake Place";
                        attachable.Note = "Attachable note123 ";
                        attachable.Tag = "Attachable tag123 ";
                        using (System.IO.FileStream fs = file.OpenRead())
                                {
                                    attachable.ContentType = "image/jpeg";
                                    attachable.FileName = file.Name;
                                    Attachable attachableUploaded = commonServiceQBO.Upload(attachable, fs);
                                }