filestream

How to write to a stream then to file

匆匆过客 提交于 2019-12-11 11:06:47
问题 As part of another project, I found this article explaining how to bring up a SaveFileDialog. But in the center of the code there is a comment that simply reads //Code to write the stream goes here. and seeing as I don't know how to do this either I am at a bit of a loss. In the end my code will be compiling a list of user selections, each separated by a newline character, and then saving that list to a .json with a name and a location specified by the user. The user will have the option to

problems sending picture from client to server

百般思念 提交于 2019-12-11 10:26:20
问题 i am trying to send a picture from 'C:\picture.bmp' to 'c:\temp\picture.bmp' using server and client socket clients onconnect event handler is as follow: procedure TForm2.ClientSocket1Connect(Sender: TObject; Socket: TCustomWinSocket); var fs : tfilestream; begin fs := TFileStream.create('C:\picture.bmp', fmOpenRead);//picture allready exists socket.SendStream(fs); fs.free; end; and servers onclientread as : procedure TForm2.ServerSocket1ClientRead(Sender: TObject; Socket: TCustomWinSocket);

how to detect if tfilestream has been freed?

 ̄綄美尐妖づ 提交于 2019-12-11 09:58:15
问题 is there a way to see if an instace of tfile stream is being used? for example if i declare FS of type tfilestream,write buffer to it and finally free the stream using tfilestream.free can i check something like: if tfilestream.NotActive then //code if tfilestream.beingused then //code if tfilestream.free = true then //code active and beingused methods do not exists for real nor can we test tfilestream.free = true just making this up to give idea what i am trying to ask 回答1: You can't do it

Javascript write file without overwrite

前提是你 提交于 2019-12-11 08:44:27
问题 I am using XPCOM to read/write file(s) on my hard drive (since Java is no longer supported on FF16,17,18,+ I have to use this). I use it in my FireFox extension(s) (I use iMacros). On this document click I found this example. var string = '\u5909\u63db\u30c6\u30b9\u30c8'; file.initWithPath('C:\\temp\\temp.txt'); file.create(file.NORMAL_FILE_TYPE, 0666); var charset = 'EUC-JP'; var fileStream = Components .classes['@mozilla.org/network/file-output-stream;1'] .createInstance(Components

System.IO.FileInfo throwing access is denied exception to a local file

孤者浪人 提交于 2019-12-11 07:32:59
问题 I created a sample Silverlight Web project and I am getting 'Access is denied' when I do this: string fileName = "map.gif"; FileInfo fileInfo = new FileInfo(fileName); How can I give the web project access to this folder/file? I added the image into my project, really drawing a blank here.... 回答1: You don't access files you've placed in the project using the FileInfo object. Instead you create a Uri to access it. Its not clear from your question which project you've place the file in. If you

Filestream in Sql Server 2008 Express

谁说我不能喝 提交于 2019-12-11 07:24:41
问题 i tried to get it to work but i never seem to have to luck, i go a code snippet for a blog and still no dice. This is the code. EXEC sp_configure filestream_access_level, 1 GO RECONFIGURE GO CREATE DATABASE NorthPole ON PRIMARY ( NAME = NorthPoleDB, FILENAME = 'C:\Temp\NP\NorthPoleDB.mdf' ), FILEGROUP NorthPoleFS CONTAINS FILESTREAM( NAME = NorthPoleFS, FILENAME = 'C:\Temp\NP\NorthPoleFS') LOG ON ( NAME = NorthPoleLOG, FILENAME = 'C:\Temp\NP\NorthPoleLOG.ldf') GO 回答1: You need to enable

how to save aspx file as html file and folder to local machine or server

谁说胖子不能爱 提交于 2019-12-11 06:35:37
问题 in my web application my client wants to save the current aspx page as html file and also save the related file(jquery, images ...) in a folder. basically that what is being done in the background when you right click and press "save to" in the browser and I want to do that by a click of a button(webcontrol). i found a piece of code that will save the html file itself but i don't know how to save also the related folder. private void SavePageASHtml(string location) { StringWriter stringWriter

System.UnauthorizedAccessException loading file from Disk

 ̄綄美尐妖づ 提交于 2019-12-11 05:26:55
问题 Really weird problem loading a file from disk: string path = HttpContext.Current.Server.MapPath("~/Datasets/blob.xml"); FileStream stream = new FileStream(path, FileMode.Open); Throws exception: An exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll but was not handled in user code Additional information: Access to the path 'D:\webroot\afob\Dev\v1.0.x\AFOB\Datasets\blob.xml' is denied. The strange thing is it was working 5 minutes ago. I checked permissions on the

storing files in sql server 2008 using the filestream option

感情迁移 提交于 2019-12-11 04:47:34
问题 i am using an asp.net mvc 2 application to upload files and store them in a sql server 2008 db. I would like to use the filestream option. Does anyone has any code samples for this? 回答1: The SQL part: -- Enable the FileStream Feature EXEC sp_configure filestream_access_level, 2 GO RECONFIGURE GO --Create a special file group and mark it as a stream CREATE DATABASE FileStreamExample ON PRIMARY ( NAME = FileStreamExample_Primary, FILENAME = 'c:\Data\FileStreamExample.mdf'), FILEGROUP

How to use flash.filesystem.FileStream [closed]

久未见 提交于 2019-12-11 03:58:02
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Will How to use flash.filesystem.FileStream ? FileStream.as file Where? 回答1: The class flash.filesystem.FileStream is only available in Adobe AIR. It is not available in Flash Player in the browser. Furthermore, there is no FileStream.as available to read the source code because it is compiled into the runtime