Help required: zip files streaming RRS feed

  • Question

  • Hi all,

    i have problem in sending zip file in network.. all other formats i am able to send except .zip..

    i tried a lot i dont no how to do this.. the code i have written at client side to upload file, this is suggested by microsoft here is the link

    i am able to create zip file, if i try to open it says corrupted..size of the file also varying lot.

    here is code

    public void UploadFile(string localFile, string uploadUrl)
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uploadUrl);
            req.Method = "PUT";
            req.AllowWriteStreamBuffering = true;
            // Retrieve request stream and wrap in StreamWriter
            Stream reqStream = req.GetRequestStream();
            StreamWriter wrtr = new StreamWriter(reqStream);
            // Open the local file
            Stream Stream = File.Open(localFile, FileMode.Open);
            // loop through the local file reading each line 
            //  and writing to the request stream buffer 
            byte[] buff = new byte[1024];
            int bytesRead;
            while ((bytesRead = Stream.Read(buff, 0,1024)) > 0)
            catch(Exception ee)

    please help me


    Friday, November 20, 2009 6:38 AM


  • Hi Grabit,

    Firstly your code seems right, Here is a sample from this thread, you can have a try:

    FileInfo fInfo = new FileInfo(OpenFileDialog1.FileName);


    long numBytes = fInfo.Length;


    FileStream fStream = new FileStream(OpenFileDialog1.FileName, FileMode.Open, FileAccess.Read);


    BinaryReader br = new BinaryReader(fStream);


    byte[] bdata = br.ReadBytes((int)numBytes);



    Best regards,
    Guang-Ming Bian - MSFT

    Please remember to mark the replies as answers if they help and unmark them if they provide no help
    • Marked as answer by warrentang Thursday, November 26, 2009 9:31 AM
    Monday, November 23, 2009 6:58 AM