Convert Image to byte array and pass it to web api to save image on server
<p>I want to do convert image in byte array and pass it to web api to save image on server and image name in database.</p>

<p>I have done following code but getting exception as <strong>Parameter is not valid</strong> when I am using this block - </p>

<pre><code>byte[] param contains byte array value of image from request url
     using (var ms = new System.IO.MemoryStream(param))
                    {
                        var cd= Image.FromStream(ms);
     //...
                    }

 using (var ms = new System.IO.MemoryStream(param))
                    {
                        var Image= Image.FromStream(ms);
     //...
                    }
</code></pre>

<p>I have tried the solutions as I have found in searching but same error occured.</p>

<p>Can anyone help me to resolve this error.</p>