流和文件流 [英] stream and file stream
本文介绍了流和文件流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨。
我有文件上传器,我想用FTP和FTPUpload类上传文件。我需要文件流如何从文件上传器获取文件流?
如何将流复制到文件流?
Hi.
I have file uploader and I want to upload a file with FTP and FTPUpload class. I need the filestream how can I get filestream from file uploader ??
How can I copy stream to file Stream ?
System.IO.FileStream myStream;
Stream fs = FileUpload1.PostedFile.InputStream;
// Code here to write in mySteam From Stram fs
Upload.FTPUpload(myStream, "*********", "******", "*******");
推荐答案
Kunal他正在尝试将流转换为文件流,
Hi,
Kunal he is trying to Convert stream to file stream,
public static void CopyStream(Stream input, Stream output)
{
byte[] buffer = new byte[8 * 1024];
int len;
while ( (len = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, len);
}
}
这将对您有所帮助:)
This will help you :)
它不是改变流到文件流它只是将输入流复制到输出流
it''s not change stream to file stream it''s just copy a input stream to output stream
这篇关于流和文件流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文