
Subir un archivo
Publicado por Agustin (32 intervenciones) el 08/09/2004 02:31:32
Señores muchas gracias por la ayuda que se me esta dando. Pero tengo un nuevo problema, quiero subir un archivo al servidor he usado el siguiente codigo:
if (fileFoto.PostedFile != null)
{
string filepath = Path.Combine("\\inetpub\\temporal", Path.GetFileName(fileFoto.Value));
try
{
fileFoto.PostedFile.SaveAs(filepath);
Mensaje.Text = "Archivo cargado correctamente en <b>" + filepath + "</b> en el servidor Web";
}
catch (Exception exc)
{
Mensaje.Text = "Error al guardar el archivo <b>" + filepath + "</b><br>"+ exc.ToString();
return;
}
}
Y me funciona perfectamente, pero por jemplo si quiero mandarlo a: "C:\inetpub\wwwroot\proyecto\fotos" Me marca error.
Tambien he usado la instruccion. Path.GetTempPath( ) Pero esta manda el archivo al directorio temporal de windows.
De antemano gracias, a quien me pueda ayudar!!!
if (fileFoto.PostedFile != null)
{
string filepath = Path.Combine("\\inetpub\\temporal", Path.GetFileName(fileFoto.Value));
try
{
fileFoto.PostedFile.SaveAs(filepath);
Mensaje.Text = "Archivo cargado correctamente en <b>" + filepath + "</b> en el servidor Web";
}
catch (Exception exc)
{
Mensaje.Text = "Error al guardar el archivo <b>" + filepath + "</b><br>"+ exc.ToString();
return;
}
}
Y me funciona perfectamente, pero por jemplo si quiero mandarlo a: "C:\inetpub\wwwroot\proyecto\fotos" Me marca error.
Tambien he usado la instruccion. Path.GetTempPath( ) Pero esta manda el archivo al directorio temporal de windows.
De antemano gracias, a quien me pueda ayudar!!!
Valora esta pregunta


0