filestream

Sending File in Chunks to HttpHandler

Hello, I'm trying to send a file in chunks to an HttpHandler but when I receive the request in the HttpContext, the inputStream is empty. So a: while sending I'm not sure if my HttpWebRequest is valid and b: while receiving I'm not sure how to retrieve the stream in the HttpContext Any help greatly appreciated! This how I make my r...

FileStream.Write not Writing to File

I'm passing some Base64 encoded strings through WCF, and I'm attempting to write them to a file. However, despite the fact that my FileStream object has a Length greater than 0, my file on disk remains empty. FileStream fs = new FileStream(Config.Instance.SharedSettings.SaveDir + StudyInstance.StudyId + "\\tmp.ext", FileMode.Create); E...

SQL 2008: Filestream versus Binaries in the database.

Hello, Yesterday I asked the question on how I should save my files. After some research I've desided to go with storing the files "in" the database. I've checked the difference between storing the files using filestream and storing the files in the database itself. Each has it's advantages and disadvantages. To help me with my resear...

Has anyone used Classic ASP with SQL Server 2008 and it's new FileStream feature?

I'm getting ready to use SQL Server 2008's FileStream capability but I'm not sure if Classic ASP can read and write from SQL 2008 FileStream. We still have an old application we'd like to update to support File Uploads to database and would like to consider FileStream. If needed I can build a COM object via .NET to handle this but would...

Will closing a FileStream close the StreamReader?

If I use a FileStream to create a StreamReader, will the StreamReader close when I close the FileStream or will I need to close the StreamReader too? public void ReadFile() { var file = new FileStream("c:\file.txt", FileMode.Open, FileAccess.Read); var reader = new StreamReader(file); try { txtFile.Text = reader.Re...

Reading values from file stream and storing them into a variable size array - OpenGL and C

Hi, I am trying to read the following file (The comments are not there in the original): Tetra.tri 4 4 // tot number of vertexes & tot number of triangles 0.693361 0.693361 0.693361 // vertex coordinates 0.693361 -0.693361 -0.693361 -0.693361 -0.693361 0.693361 -0.693361 0.693361 -0.693361 3 1 2 3 // triangles to display (the 3...

How to put pointer in the desired place in a stream using PHP?

Hello! Currently I'm making data parser via Telnet connection using PHP. I've encountered problem: I need to put pointer in a stream to the certain place(not to the end of data), but using of fseek() function is impossible with streams. Tell me, please, how can I solve this problem? ...

C# FileStream : Optimal buffer size for writing large files ?

Suppose I'm writing a couple of files to disk, between 2MB and 5GB. What are sensible buffer values for the FileStream ? Is it sensible to work with buffersizes of several megabytes, or should I stick to kilobyte-buffers ? ...

Two CryptoStreams associated with one file in C#

I would like to create a file "myFile" that encrypts the first part using a certain key, and the last part using a certain key. So far I have something like this: cs1 = new CryptoStream(myFile, symmetricKey1.CreateEncryptor(key1, key1IV), CryptoStreamMode.Write); cs2 = new CryptoStream(myFile, symmetricKey2.CreateEncryptor(key2, key2I...

How to handle concurrent file access with a filestream/streamwriter?

I am writing an audit file that is writing the username, time, and the old/changed values of several variables in the application for each user when they use my application. It is using a FileStream and StreamWriter to access the audit file. All audits for each user will be written to the same file. The issue is that when two users ...

Weird behaviour of FileStream in WinForms

I have a WinForms application that checks for a TXT file in the application directory. There will be only a single line (user's email) or none. the code is like this: public static string GetUserEmail() { string path = Application.StartupPath + "\\mail.txt"; MessageBox.Show(path); string adres = String.Empty; ...

FileStream seems to find an unexisting file

I have this code: public static string GetUserEmail() { string path = Application.StartupPath + "\\mail.txt"; MessageBox.Show(path); string adres = String.Empty; if (File.Exists(path)) { using (StreamReader sr = new StreamReader(path)) { adres = sr.ReadLine(); } } else { ...

.NET File Stream write method writes all empty lines

I am having a C# console application access files over a network and write to it. I noticed that some files have been corrupted and have only null written to them. I did not get any exceptions. I am using simple code that writes a byte array to the file's stream. When opening the files in Binary mode, all i see are Zeros, something like...

How to convert .txt to .mht?

How to convert a flat .txt file to .mht? What APIs are available to help with the conversion? ...

Edit a specific Line of a Text File in C#

Hi everybody I have two text files, Source.txt and Target.txt, the source will never be modified and contain N lines of text. So, I want to delete an specific line of text in Target.txt, and replace by an specific line of text from Source.txt, I know what number of line I need, actually is the line number 2, both files. I haven somethi...

SQL Server 2008 FILESTREAM performance

I had some questions around the FILESTREAM capability of SQL Server 2008. What would the difference in performance be of returning a file streamed from SQL Server 2008 using the FILESTREAM capability vs. directly accessing the file from a shared directory? If 100 users requested 100 100Mb files (stored via FILESTREAM) within a 10 seco...

SQL Server FILESTREAM storage

If I have a SQL Server 2008 database that uses FILESTREAM and stores 10 terabytes of files. Must all the files reside on the same physical box (requiring a 10+ terabyte server)? Or can I store 1 terabyte on one server, another terabyte on a second server, and so on? From what I have read it appears you can only store files on a single...

Win32 streaming API and the DMZ

We are investigating the use of the Win32 streaming API to pull out files stored with the FILESTREAM capabilities in SQL 08. If a web application, sitting on the public side of the firewall uses the streaming API to pull back a file, what ports must be opened to make this happen? Also, are there any NTFS file/directory permission issue...

FILESTREAM access via streaming API

On a web server, we plan to pull back a file stored in SQL in a FILESTREAM using the Win32 streaming API. Are there any special ports that must be opened to make this work? Or will the standard 1433 suffice? ...

TSQL/VB.NET - write stream to a table

Dear Folk's i'm using the following code in order to send the bytes of a picture into the stream table: Dim FirstColumnNames As String = imTable(0) & "_Code, " & imTable(0) & "_Price, " & imTable(0) & "_Title, " & imTable(0) & "_Type, " & imTable(0) & "_Height, " & imTable(0) & "_Width, " & imTable(0) & "_Comments " Dim FirstFieldsValue...