Hi,

I have a application where we upload pdf files.And also i have button in another page to download it.As and wen a new file is uploaded that file should be downloaded on clicking the download button.

The follwing code fetches all the pdf files
filelist contains all pdf files..
Further how to download latest uploaded file.
Can anyone help me out PLZ.

DirectoryInfo dirInfo = new DirectoryInfo(Server.MapPath(@"\sssssss\"));
        ArrayList fileList = new ArrayList();
        string[] fExtensions = { "*.pdf"};
        foreach (string ext in fExtensions)
        {
            fileList.AddRange(dirInfo.GetFiles(ext, SearchOption.AllDirectories));
        }

        ArrayList tempList = new ArrayList();
        tempList = fileList;
      

        for (int i = 0; i < fileList.Count; i++)
        {
            for (int j = i + 1; j < fileList.Count; j++)
            {
                if (fileList[j].ToString() == fileList[i].ToString())
                {
                    tempList.RemoveAt(j);
                }
            }
        }
        fileList = tempList;

i guess you will just move the pdf files into another directory..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.