title: File upload in asp.net c#
body: <p>hey guys, m using an api of "<a href="http://developer.longtailvideo.com/botr/" rel="nofollow">Bits on the Run</a>" following is the code of upload API</p>
  
  <pre><code>   public string Upload(string uploadUrl, NameValueCollection args, string filePath) 
     {
          _queryString = args; //no required args
  
          WebClient client = createWebClient();
          _queryString["api_format"] = APIFormat ?? "xml"; //xml if not specified - normally set in required args routine                                   
          queryStringToArgs();
  
          string callUrl = _apiURL + uploadUrl + "?" + _args;
          callUrl = uploadUrl + "?" + _args;
  
          try {
               byte[] response = client.UploadFile(callUrl, filePath);
               return Encoding.UTF8.GetString(response);     
          } catch {
              return "";
          }   
      }
  </code></pre>
  
  <p>and below is my code to upload a file, m using FileUpload control to get the full path of a file(but m not succeeded in that)...</p>
  
  <pre><code>            botr = new BotR.API.BotRAPI("key", "secret_code");   
              var response = doc.Descendants("link").FirstOrDefault();
              string url = string.Format("{0}://{1}{2}", response.Element("protocol").Value, response.Element("address").Value, response.Element("path").Value);
              //here i want fullpath of the file, how can i achieve that here
              string filePath = fileUpload.PostedFile.FileName;//"C://Documents and Settings//rkrishna//My Documents//Visual Studio 2008//Projects//BitsOnTheRun//BitsOnTheRun//rough_test.mp4";
  
              col = new NameValueCollection();
  
              FileStream fs = new FileStream(filePath, FileMode.Open);
  
              col["file_size"] = fs.Length.ToString();
              col["file_md5"] = BitConverter.ToString(HashAlgorithm.Create("MD5").ComputeHash(fs)).Replace("-", "").ToLower();
              col["key"] = response.Element("query").Element("key").Value;
              col["token"] = response.Element("query").Element("token").Value;
  
              fs.Dispose();
              string uploadResponse = botr.Upload(url, col, filePath);
  </code></pre>
  
  <p>i read in some forums saying that for some security purpose you can't get fullpath of a file from client side. If it is true then how can i achieve file upload in my scenario ?</p>