Click here to Skip to main content
15,880,972 members
Please Sign up or sign in to vote.
3.00/5 (4 votes)
See more:
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 ?

C#
 System.IO.FileStream myStream;
 Stream fs = FileUpload1.PostedFile.InputStream;
// Code here to write in mySteam From Stram fs
 Upload.FTPUpload(myStream, "*********", "******", "*******");
Posted
Updated 28-Dec-12 6:25am
v2
Comments
[no name] 26-Dec-12 12:08pm    
System.IO.FileStream myStream;

// Code here to write in mySteam From Stram fs
Upload.FTPUpload(myStream, "*********", "******", "*******");
Stream fs = FileUpload1.PostedFile.InputStream;
farham_heidari 26-Dec-12 12:16pm    
?
farham_heidari 26-Dec-12 12:09pm    
?????????
[no name] 26-Dec-12 12:20pm    
Stream fs = FileUpload1.PostedFile.InputStream; comes after uploading the file..
Its my blind assumption....
farham_heidari 26-Dec-12 12:27pm    
i want to upload mystream that is a filestream but i have stream ...

Hi,

Kunal he is trying to Convert stream to file stream,

C#
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 :)
 
Share this answer
 
it's not change stream to file stream it's just copy a input stream to output stream
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900