Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using (StreamReader CsvReader = new StreamReader(input_file))
- {
- string inputLine = "";
- while ((inputLine = CsvReader.ReadLine()) != null)
- {
- values.Add(inputLine.Trim().Replace(",", "").Replace(" ", ""));
- }
- CsvReader.Close();
- return values;
- }
- if(!Request.Content.IsMimeMultipartContent())
- {
- return "|UnsupportedMediaType";
- }
- try
- {
- var provider = new MultipartMemoryStreamProvider();
- await Request.Content.LoadIntoBufferAsync().ConfigureAwait(false);
- await Request.Content.ReadAsMultipartAsync(provider).ConfigureAwait(false);
- HttpContent content = provider.Contents.FirstOrDefault();
- if(content != null)
- {
- Stream stream = await content.ReadAsStreamAsync().ConfigureAwait(false);
- using (StreamReader CsvReader = new StreamReader(stream))
- {
- string inputLine = "";
- while ((inputLine = CsvReader.ReadLine()) != null)
- {
- string[] vars = inputLine.Split(',');
- }
- CsvReader.Close();
- //return values;
- }
- }
- }
- catch(Exception e)
- {
- return e.ToString();
- }
- return "Nothing To Process";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement