开发者

C# .exe upload of multiple files to PHP server - filename param?

开发者 https://www.devze.com 2023-01-04 11:44 出处:网络
What is the best way for a C# .exe program, to upload to a php server script that accepts file uploads.

What is the best way for a C# .exe program, to upload to a php server script that accepts file uploads.

If using .NET WebClient is the only way, is there a way for WebClient to specify the parameter name, rather than just the file?

For example, the C# .exe would do basically what a simple html form would do in this case.

<input name="filename" type="file" />开发者_高级运维

How do you specify this name parameter using WebClient?


You could try UploadFileEx from CodeProject.


You can acheive this with the HttpWebRequest class. It's a bit tricky since you will most likely need to upload the file using MIME multipart formatting. However, this post explains this process much better than I can: Upload files with HTTPWebrequest (multipart/form-data)

Good luck to you :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号