FileInfo-----local machince vs/Hosting machine---help needed
-
Hi Friends, I am trying to read file info using following code. When i run it on my local machine it works 100% but when I upload it to hosting server it throws exception!! or in other words it goes to else all the time can any one hlep me why? string fileOpenPath =this.FileUpload1.FileName.ToString(); FileInfo fi = new FileInfo(fileOpenPath); //Ceck if file file exists if (fi.Exists ) { //do some work } else { //show message }
Naveed Kamboh Complexity kills, Write easy code for your self. isolutionteam
-
Hi Friends, I am trying to read file info using following code. When i run it on my local machine it works 100% but when I upload it to hosting server it throws exception!! or in other words it goes to else all the time can any one hlep me why? string fileOpenPath =this.FileUpload1.FileName.ToString(); FileInfo fi = new FileInfo(fileOpenPath); //Ceck if file file exists if (fi.Exists ) { //do some work } else { //show message }
Naveed Kamboh Complexity kills, Write easy code for your self. isolutionteam
That's because the file doesn't exist on the server. You can't use a file path that references a file on the client computer to access a file on the server. When you are running it on your own computer, the client and the server is the same, so the file that exists on the client also exists on the server.
--- single minded; short sighted; long gone;
-
That's because the file doesn't exist on the server. You can't use a file path that references a file on the client computer to access a file on the server. When you are running it on your own computer, the client and the server is the same, so the file that exists on the client also exists on the server.
--- single minded; short sighted; long gone;
Could you please help me how can i do that then. some Code please
Naveed Kamboh Complexity kills, Write easy code for your self. isolutionteam
-
Could you please help me how can i do that then. some Code please
Naveed Kamboh Complexity kills, Write easy code for your self. isolutionteam
-
Could you please help me how can i do that then. some Code please
Naveed Kamboh Complexity kills, Write easy code for your self. isolutionteam
Thanks , I've sorted.
Naveed Kamboh Complexity kills, Write easy code for your self. isolutionteam