Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The bolded line of code below works when ran locally....but will not work when published to the server and ran from the web.
The error it gives is: "can't find "c:/....."
I know what it's doing....it's trying to find that path/file on the server when it needs to be looking locally.
How do I make it look locally for that file/path so it can be converted to a stream?
I'm using the .ASP fileupload button that visual studio provides.
NOTE: the word filePath below is just a variable.....as I said above, I successfully load the file completely into my SQL Database when it's ran locally. I just can't make it look locally for a file when ran from the server.


FileStream fs = new FileStream(filePath,FileMode.Open, FileAccess.Read);

Thanks for any help/advice you can provide.

Jonathan
Posted
Comments
joshrduncan2012 12-Jul-13 16:25pm    
Is your goal for it to be able to be run from the server and look for a file that is stored on the server computer or stored on the client computer?
jhill444 12-Jul-13 16:42pm    
run from the server......and look for a file that is stored on the client computer.
joshrduncan2012 12-Jul-13 16:47pm    
C:\\.... probably won't work. It might be looking for a file stored on the server computer. I would recommend making "filepath" a UNC path to see if that works. (Not verified, just a suggestion).
jhill444 15-Jul-13 13:56pm    
I've tried this several ways with no luck. Do you think I'm correct in thinking I'll need some sort of Java script to do this? what is the dang "upload file" button for if not this...maybe for use on a windows form? is it maybe not intended for server side execution?
[no name] 13-Jul-13 0:52am    
plz dont store any image to the database(My advice). Instead store the image in server(probably to ur project folder) and store only the image name in database.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900