Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am using MVC4 and VS2013. My doubt is I need to get all the files in a directory that is I don't want a normal file upload. So I am using
string[] getACHfilefromroot = Directory.GetFiles(directoryach); where the directoryach has the root/path and it is returning as string array not as files.

But I need to process these files and then I want to use InputStream that is
streamUsaePay = fileusa.InputStream; is the code which is used with in a foreach loop inside another Action Method and fileusa is the var that holds filename extracted from getACHfilefromroot.
And the thing is I need to process the .csv files or xlsx files and then need to split the details into 4 t o 5 txt files by clustering it.

Why I am stressing that I need to use InputStream is I am passing that stream variable for further processing.

I am trying different logics for hardly two days to get the files as stream/as files itself but I am not.
Please can anyone help me?
Thanks in Advance!!
Posted
Updated 14-Jan-15 3:44am
v2

1 solution

> it is returning as string array not as files.

That's what it's supposed to do. Loop through each filename, open the file and process it as required. See this tutorial on how to open a file for reading:

http://www.dotnetperls.com/file[^]

/ravi
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900