Matthew Flynn
Matthew Flynn

Reputation: 3931

Secure image storage for webapi 2.0

I currently have a webapi 2.0 being developed with visual studio. This api has images posted to it and then we store locally on the server (in this case we simple map ~/images/signatures to the local file system and save the image). This path is stored as an app setting in the web.config.

Can anyone please recommend how I can resolve the following;

  1. Upon performing a visual studio publish as the ~/images/signatures folder is held inside the door folder it's ftping to its deleting the said folder each time and everything in it.

  2. As above as the folder is effectively inside the /images folder it's is allowing access to the images through the browser, again something we want to avoid.

Short of hard coding a local file path store on the server what would be the best way around this issue?

Upvotes: 0

Views: 300

Answers (1)

Donal
Donal

Reputation: 32713

You should convert the images to binary format and save in them in a database, never in an images folder. You should never store images anywhere they can be directly accessed by a known URL within your website folder structure.

Upvotes: 1

Related Questions