ASP.NET - importar archivo plano

 
Vista:

importar archivo plano

Publicado por barruntoc salazar (2 intervenciones) el 01/05/2016 19:49:30
Hola A o todos necesito una ayuda:

Como hago para importar un archivo .txt separado por , estoy trabajando en C# con asp.net ,

o alguien tiene un ejemplo gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

importar archivo plano

Publicado por Daniel Alejandro Rosas Vazquez (7 intervenciones) el 27/05/2016 05:55:54
Hola que tal.. Podria servirte este metodo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
if(IsPostBack)
{
	Boolean fileOK = false;
	String path = Server.MapPath("~/UploadedImages/");
	if (FileUpload1.HasFile)
	{
		String fileExtension =
			System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
		String[] allowedExtensions =
			{".gif", ".png", ".jpeg", ".jpg"};
		for (int i = 0; i < allowedExtensions.Length; i++)
		{
			if (fileExtension == allowedExtensions[i])
			{
				fileOK = true;
			}
		}
	}
 
	if (fileOK)
	{
		try
		{
			FileUpload1.PostedFile.SaveAs(path
				+ FileUpload1.FileName);
			Label1.Text = "File uploaded!";
		}
		catch (Exception ex)
		{
			Label1.Text = "File could not be uploaded.";
		}
	}
	else
	{
		Label1.Text = "Cannot accept files of this type.";
	}
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar