title: C# upload file to server - both client and server side
body: <p>I'm a C# game programmer with little web development experience.</p>
  
  <p>I need to upload a small file (25-100 or so bytes, depending on it's content) to a server. This is on the Windows Phone 7 using XNA. The target server is fairly limited and only supports PHP and classic ASP.</p>
  
  <p>Since the CF on the WP7 only has access to a limited subset of networking commands, it's looking like an HttpWebRequest GET aimed at a script that saves the file will be the best option. The data I'm sending is small in size, and should be able to be passed as a parameter in the url.</p>
  
  <p>I've been searching but have yet to find a complete example of this, which handles both the client and server side script (mainly the latter). This is close to what I'm looking for, except it has no mention of the server side script: <a href="https://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data/567460#567460">Upload files with HTTPWebrequest (multipart/form-data)</a> </p>
  
  <p>The closest that I got was this: <a href="http://www.johny.org/2007/08/upload-using-c-as-client-and-php-as-server/" rel="nofollow noreferrer">http://www.johny.org/2007/08/upload-using-c-as-client-and-php-as-server/</a></p>
  
  <p>But when attempting to use it I get an unhandled exception: "The remote server returned an error: (405) Method Not Allowed". This method seems the most promising so far, but I've yet to be able to debug this.</p>
  
  <p>Unfortunately, I have a short amount of time to implement this, and as I said only a passing familiarity with web development. I'm not worried about maximum security or scalability as this is a temporary measure to collect feedback internally. Basically, I just need the quickest thing that works. ;)</p>
  
  <p>Any help would be fantastic!</p>