Uploading files in dedicated server with asp.net
<p>I upload files and convert it into bytes and saved it in Database. It works correctly in my local system. but I hosted it in dedicated server, it cannot convert path into bytes. It shows an error </p>

<blockquote>
  <p>'Could not find a part of the path 'C:\fakepath\1003.pdf'.</p>
</blockquote>

<p>Code:</p>

<pre><code>//byte[] bContent = myWebClient.DownloadData(@strFileUploadSubSplit[3]);
byte[] bContent = null;

// Open file for reading
System.IO.FileStream _FileStream = new System.IO.FileStream(strFileUploadSubSplit[3].ToString(), System.IO.FileMode.Open, System.IO.FileAccess.Read);
// attach filestream to binary reader
System.IO.BinaryReader _BinaryReader = new System.IO.BinaryReader(_FileStream);
// get total byte length of the file
long _TotalBytes = new System.IO.FileInfo(strFileUploadSubSplit[3].ToString()).Length;
// read entire file into buffer
bContent = _BinaryReader.ReadBytes((Int32)_TotalBytes);
// close file reader
_FileStream.Close();
_FileStream.Dispose();
_BinaryReader.Close();

string base64String = System.Convert.ToBase64String(bContent, 0, bContent.Length);
str = strFileUploadSubSplit[0] + "*" + strFileUploadSubSplit[1] + "*" + strFileUploadSubSplit[2] + "*" + base64String ;
string URL = "http://dev2.weicorp.com:81/IApp.svc/IApp/Doc";
string ret = string.Empty;
var webRequest = System.Net.WebRequest.Create(URL) as HttpWebRequest;
byte[] byteArray = Encoding.UTF8.GetBytes(str);
webRequest.Method = "POST";
webRequest.ContentType = "application/octet-stream";
webRequest.ContentLength = byteArray.Length;
Stream dataStream = webRequest.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
HttpWebResponse resp = (HttpWebResponse)webRequest.GetResponse();
dataStream = resp.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
ret = reader.ReadToEnd();
string status = ret.ToString();
context.Response.Write(status);
</code></pre>
