Uploading files to site / datatable
I'm trying to make a little site for few people. Basically what i'm looking for is that users can register to this site, log on and upload files. I want the files to upload to a new folder that is named after the uID for example.
User Tommy registers and get user id 1234. Then his upload folder will be http://www.site.com/users/1234/upload/
He is the only one that has access to this data and can delete them.
Another way would be storing this info in the sql. I'm using MS SQL 2008. Can i save the upload attachments right in the datatable ? or should i have one account that has full rights that will make the folders for the users and save the direct link in the database ?
I'm going for a little, very so light version of dropbox.com 开发者_运维知识库but only in a browser form.
And if you go though folder route,
System.IO FileInfo and DirectoryInfo will give you all the info you need about the contents of a folder, and the files within it.
And dont forget Server.MapPath() :)
Take a look at FILESTREAM in SQL Server 2008, which is designed to efficiently store unstructured data.
BOL: FILESTREAM Overview
精彩评论