title: C# Convert Image To FileStream
body: <p>My application so far lets the user select an image via the file selector and upload it through a file stream via FTP:</p>
  
  <pre><code>        Stream ftpStream = request.GetRequestStream();
          FileStream file = File.OpenRead(fileToUpload);
          length = 1024;
  
          buffer = new byte[length];
             do
              {
                  bytesRead = file.Read(buffer, 0, length);
                  ftpStream.Write(buffer, 0, bytesRead);
                  totalReadBytesCount += bytesRead;
                  var progress = totalReadBytesCount * 100.0 / totalToUpload;
                  backgroundWorker1.ReportProgress((int)progress);
              }
              while (bytesRead != 0);
  </code></pre>
  
  <p>This works fine. 
  The selected image is saved as a file and then uploaded.</p>
  
  <p>Now, however, I wish to save it as a 'Image' so I can resize it etc. So that the code would be:</p>
  
  <pre><code>            if (openFileDialog1.ShowDialog() == DialogResult.OK)
          {
              image = Image.FromFile(openFileDialog1.FileName);
          }
  </code></pre>
  
  <p>As opposed to:</p>
  
  <pre><code>  if (openFileDialog1.ShowDialog() == DialogResult.OK)
      {
          file = openFileDialog1.FileName;
      }
  </code></pre>
  
  <p>My question thus is:</p>
  
  <p>Now my selected file is a Image file. How do I convert it into the filestream? If this can't be done easily then how would I upload the image via ftp?
  Thanks in advance.</p>