How do/should I prepare a folder for stored image, reference from sql, save the image location using C#
Really hoping someone can provide some code sample or point me in the rig开发者_JAVA百科ht direction (with examples C#.net). I did try to check if this question was asked before.. but didn't really find code samples which answered all my questions.
- Image folder for saved files -should this be in the solution or somewhere else
- What kind of data type - will vchar(150) for example for ok?
- What will be the typical/most ideal code to save the image in the folder location and write the image location in the db.
If you use SQL Server 2008 I would use the filestream data type. It allows for what you want to do but totally integrated with the DB (you see the column -- image -- as a varbinary(MAX)).
Not wholly sure what you mean but this could point you in the right direction:
1) Keep it in the solution unless it is to be called by more than application 2) Just use Varchar(Max) or NVarchar(Max) depending on your encoding type 3) You'll need: - In db, a stored procedure to write the image location to a table.In - In the C#, a connection object and a command object to call a stored procedure
NTFS - Suports multiple Data Streams for each file.
NetFrameWork do´nt include support for those streams.
You can use Interop to gain access to Alternate Data Streams.
Sample Csharp code on CodeProject: http://www.codeproject.com/KB/shell/csadsdetectorarticle.aspx
Note.: When you download a file from internet on Xp, the Dowloaded files has two Streams, MyFile and MyFile:Zone.Identifier
This stream contains some like this: [ZoneTransfer] ZoneId=3
精彩评论