Author: Skag55 | Posted on: 1/23/2009 9:06:26 AM | Views : 296

Hello everybody!

I am facing a bit of an issue when I am trying to read a specific folder of the path of a file. i.e.

C:\folder1\folder2\folder3\folder4\file.txt

I need to keep the "folder4" bit (or folder3 but, you get the point). I've been reading the Path and MapPath functions, but I am doing something wrong.

Ultimately, i need to pass the "folder4" value to a string which will then save the file to the repective directory so for example:

I read the file from C:\folder1\folder2\folder3\folder4\file.txt (i get the "file.txt" and the "folder4" strings)

I write the file to  X:\lalala\xxxxx\folder4 as new.txt.

 

Here's what I do so far:

 

  if (fileUpload.HasFile)
{
...

Go to the complete details ...