
Subir archivo no funciona
Publicado por Agustin (32 intervenciones) el 10/09/2004 03:57:45
Ya estoy usando este nuevo codigo para subir un archivo, de hecho solo combio lo de la ruta por el comando Server.MapPath, ya cree una carpeta dentro de mi proyecto para ir guardar los archivos, pero nada, nomas no me deja hacerlo:
if (fileFoto.PostedFile != null)
{
string filepath = Path.Combine(Server.MapPath("/inventarios/fotos_cabms/"), 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 intentar guardar el archivo <b>" + Path.GetFileName(fileFoto.Value) + "</b>";
return;
}
}
if (fileFoto.PostedFile != null)
{
string filepath = Path.Combine(Server.MapPath("/inventarios/fotos_cabms/"), 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 intentar guardar el archivo <b>" + Path.GetFileName(fileFoto.Value) + "</b>";
return;
}
}
Valora esta pregunta


0