Save file inside a shared folder of a server

0

I am trying to save a file in a folder with a part of a server using this code Archivo.PostedFile.SaveAs(ruta) marks me an error:

El método SaveAs está configurado para que requiera una ruta de acceso raíz y la ruta de acceso '~\servido\carpeta\archivo.xlsx' no es de raíz

I could indicate another function to save the file.

    
asked by ARR 08.02.2018 в 23:52
source

1 answer

1

You can try making a copy of the original file to the path of the shared folder, but if you can show more code to see what you are trying to save because you do not clarify what you try to save if it is a file that you create or is it one that you take from another part and so ...

        if (!Directory.Exists(la ruta de tu archivo))
        {
            Directory.CreateDirectory(la ruta de tu archivo);
        }

    try
  {
     File.Copy(nombre arvhivo, ruta de destino, true);
  }
    catch (IOException ex)
  {
     MessageBox.Show(ex.Message);
  }
    
answered by 09.02.2018 / 00:07
source