开发者

How do CMS upload images?

I am just playing around and trying to make a very simple CMS. Right now I what I do right now is I 开发者_JS百科use "FtpWebRequest" to get the file that they want to change around and stick it into a jquery plugin call html area(rich html editor).

Now I am wondering how could I allow them to add images that are not already hosted? Ie not on imageshack or something.

I am guessing I need to somehow upload the file and then store it somewhere but not sure how to do all that.

Thanks


A common approach for CMS systems that need to work in low-trust environments (like shared hosting) is to use the FileUpload control, and save the uploaded file as a binary (BLOB) in a database. This avoids dealing with the headache of disk access rights on the web server.

If you're using SQL Server, here's a great article on the database side of things (storing images as BLOBs).

The .NET side of things is pretty straightforward. The FileUpload.PostedFile property has all the information about the uploaded file, including a byte stream of its data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜