I'm making a program that uploads my game to an Ftp server but when the data is compressed something goes wrong and I end up with an array of zeroes.

Here's my code:

FileStream filestream = File.OpenRead(file);
                    byte[] filebyte = new byte[filestream.Length];
                    filestream.Read(filebyte, 0, filebyte.Length);

                    //MemoryStream inS = new MemoryStream(filebyte);
                    MemoryStream outS = new MemoryStream();

                    GZipStream gzip = new GZipStream(outS, CompressionMode.Compress, true);
                    gzip.Write(filebyte, 0, filebyte.Length);
                    byte[] compressed = new byte[outS.Length];
                    outS.Read(compressed, 0, compressed.Length);

Please help!

When you attempt to read from the MemoryStream, it is pointing at the end of the buffer. Reset the pointer to the start of the MemoryStream buffer before reading outS.Seek(0, SeekOrigin.Begin);