File.Exists - not finding file on PostBack
-
Hi I'm writing a web app to upload up to 4 images to a folder. I also have a drop-down list so the user can choose whether pic is picture 1, 2, 3 or 4 (to set order on page display). Anyway, when one picture is uploaded the user stays in the form to add more pictures. I clear the DDL and re-populate it depending on which pictures have already been uploaded - i.e if pic 1 has been uploaded, only pic 2, 3 and 4 appear in drop-down. To determine this I use File.Exists but this doesn't seem to be working on a postback (i.e it doesn't find pic1.jpg which I have uploaded. It works however, if I leave the page and then click to add an image later - could this be an issue of the folder not refreshing so it looks like the file doesn't exist or a postback problem? Any ideas would be greatly appreciated. Thanks Lorna
-
Hi I'm writing a web app to upload up to 4 images to a folder. I also have a drop-down list so the user can choose whether pic is picture 1, 2, 3 or 4 (to set order on page display). Anyway, when one picture is uploaded the user stays in the form to add more pictures. I clear the DDL and re-populate it depending on which pictures have already been uploaded - i.e if pic 1 has been uploaded, only pic 2, 3 and 4 appear in drop-down. To determine this I use File.Exists but this doesn't seem to be working on a postback (i.e it doesn't find pic1.jpg which I have uploaded. It works however, if I leave the page and then click to add an image later - could this be an issue of the folder not refreshing so it looks like the file doesn't exist or a postback problem? Any ideas would be greatly appreciated. Thanks Lorna
Member 3402886 wrote:
I'm writing a web app
This is C# Forum. Please post it to ASP.NET Fourm Thanks !!
cheers, Abhijit My Recent Article : Beginner's Guide to ASP.NET Application Folder
-
Member 3402886 wrote:
I'm writing a web app
This is C# Forum. Please post it to ASP.NET Fourm Thanks !!
cheers, Abhijit My Recent Article : Beginner's Guide to ASP.NET Application Folder
OK will do, but I am using c# code to do this!
-
OK will do, but I am using c# code to do this!
The launguage you use to write ASP.NET applications doesn't matter. Your question falls squarely within the perview of ASP.NET technologies. It has nothing to do with C# at all.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008