Get file name without extension in C#.Net file upload control

SharePoint tutorial, training and video courses Forums Microsoft .Net Get file name without extension in C#.Net file upload control

This topic contains 1 reply, has 2 voices, and was last updated by  Bijay Kumar 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)




  • Author
    Posts
  • #21667

    EnjoySharePoint
    Keymaster

    Hi All,
    I have a file upload control in my asp.net c#net web application. Here I am using a File upload control to upload files. I want to retrieve the File name without extension. If I am trying to retrieve FileName property then it is giving Filename with extension. We do not want to use any string operation. Is there any method which will provide directly the file name without extension in asp.net c#.net?



    #21670

    Bijay Kumar
    Keymaster

    You can retrieve file name without action like below:
    string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fuUploadFile.PostedFile.FileName);

    Here fuUploadFile is the id of the File upload control.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.