C# Copy, Upload Files to Network Computer

if (dtCases.DataRowCount > 0)
            {
                if (ckManualAttachment.Checked)
                {
                    OpenFileDialog o = new OpenFileDialog();
                    o.Multiselect = true; // Enable multiple file selection
                    o.Filter = "Image Files (*.jpg;*.jpeg;*.png)|*.jpg;*.jpeg;*.png|PDF Files (*.pdf)|*.pdf";
                    if (o.ShowDialog() == DialogResult.OK)
                    {
                        //create folder
                        //\\localhost\shared
                        //if exist, just copy files directly
                        //copy files

                        string sharedFolderPath = GlobalVariable.SharedLocation;

                        // New folder name
                        string newFolderName = dtCases.GetFocusedDataRow()["CaseNumber"].ToString();

                        // Full path of the new folder
                        string newFolderPath = Path.Combine(sharedFolderPath, newFolderName);

                        string[] selectedFiles = o.FileNames;
                        string fnames = string.Empty;
                        try
                        {
                            // Check if the shared folder exists
                            if (Directory.Exists(sharedFolderPath))
                            {
                                // Check if the new folder already exists
                                if (!Directory.Exists(newFolderPath))
                                {
                                    // Create the new folder
                                    Directory.CreateDirectory(newFolderPath);

                                    foreach (string sourceFilePath in selectedFiles)
                                    {
                                        // Get the file name
                                        string fileName = Path.GetFileName(sourceFilePath);

                                        // Create the destination file path
                                        string destinationFilePath = Path.Combine(newFolderPath, fileName);
                                        fnames += fileName + "\r\n";

                                        // Copy the file to the destination
                                        File.Copy(sourceFilePath, destinationFilePath, overwrite: true);

                                    }

                                    //tracking
                                    //dt = new DocumentsTracking()
                                    //{
                                    //    CurrentDivision = GlobalVariable.Division,
                                    //    DocId = Convert.ToInt32(dtData.GetFocusedDataRow()["Id"]),
                                    //    Remarks = "Attachment(s) added: \r\n" + fnames,
                                    //    UserId = GlobalVariable.UserId,
                                    //    ForwardedTo = string.Empty,
                                    //    FowardedToId = 0
                                    //};
                                    //dt.Save();
                                    //viewTracking();
                                    MsgBox.Information("Folder created successfully: " + newFolderPath + " and files where added successfully.");
                                }
                                else
                                {
                                    foreach (string sourceFilePath in selectedFiles)
                                    {
                                        // Get the file name
                                        string fileName = Path.GetFileName(sourceFilePath);

                                        // Create the destination file path
                                        string destinationFilePath = Path.Combine(newFolderPath, fileName);
                                        fnames += fileName + "\r\n";
                                        // Copy the file to the destination
                                        File.Copy(sourceFilePath, destinationFilePath, overwrite: true);
                                    }

                                    //tracking
                                    //dt = new DocumentsTracking()
                                    //{
                                    //    CurrentDivision = GlobalVariable.Division,
                                    //    DocId = Convert.ToInt32(dtData.GetFocusedDataRow()["Id"]),
                                    //    Remarks = "Attachment(s) added: \r\n" + fnames,
                                    //    UserId = GlobalVariable.UserId,
                                    //    ForwardedTo = string.Empty,
                                    //    FowardedToId = 0
                                    //};
                                    //dt.Save();
                                    //viewTracking();

                                    MsgBox.Information("Files where added successfully.");
                                }
                            }
                            else
                            {
                                MsgBox.Information("The specified shared folder path does not exist.");
                            }
                        }
                        catch (UnauthorizedAccessException ex)
                        {
                            MsgBox.Information("You do not have permission to create a folder in this directory." + ex.ToString());
                            // Console.WriteLine(ex.Message);
                        }
                        catch (Exception ex)
                        {
                            MsgBox.Information("An error occurred while creating the folder." +  ex.ToString());
                            // Console.WriteLine(ex.Message);
                        }
                    }
                }
                else
                {
                    //CaptureForm cf = new CaptureForm(dtData.GetFocusedDataRow()["DocNo"].ToString());
                    //cf.DocId = Convert.ToInt32(dtData.GetFocusedDataRow()["Id"]);
                    //cf.FileName = dtData.GetFocusedDataRow()["DocNoNew"].ToString();
                    //cf.WindowState = FormWindowState.Maximized;
                    //cf.ShowDialog();
                }
                //viewTracking();
            }