views:

393

answers:

2

Users of my web site will be able to upload a picture. This picture will land in /images/folder/picture.jpg. The question I have is: When running under VS2008, a form will insert a full row in a database column (sql server)and the picture will be uploaded to the folder. The result page will show the image. But when running the web server again later, the database will be ok but the image won't be there anymore since I guess that the local server each timer starts freshly with no content in the folder. I am new to uploading so I am wondering how you do to test this kind of thing.

Also, must the folder for the images be under /Content ? I am not sure where to put it and how it will transition when running under IIS ?

Thx

A: 

I've have to test this with my local server to see exactly what it's doing with regard to the image that's being uploaded locally... but one thought is that instead of storing the picture on the file system, store it in the database itself.

alex
Agreed - store as binary data. That also gives you options down the line for auto-generating thumbnails and different image sizes.
Mike Robinson
This is not possible. For the question I oversimplified but there will be many images. They will first be stored locally and I may use a CDN later.
Nicolas Cadilhac
+1  A: 

The ASP.NET development server does not clear the directory each time it starts. Have you verified the files are actually being written where you think they are? Seems like you've probably got some path issues and the files are possibly being written to the ASP.NET Temporary Files folder which may change from instance to instance.

Chris