Share via

Problem with FileUpload Control

Adeel Mirza 21 Reputation points
2021-12-07T10:59:43.447+00:00

I am using this source code for file upload.

if (ImportFile.HasFile == false)
{
        EmptyFile.Text = "Please select a file";
        EmptyFile.Visible = true;
        return;
}

In the local PC its working fine. But the Server where I am hosting if the file isn't selected, it throws this exception.

System.IO.DirectoryNotFoundException: Could not find a part of the path 'F:\Maverick\Projects\ProjectName\FilesUpload\'.

What I do not understand is in the server, why it skips the above condition? Does it have anything to do with the version of Visual Studio and .NET?

In Local PC, I developed the project in Visual Studio 2017 but the server I am hosting it has Visual Studio 2013 not 2017

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.