[英]C# How to receive file sent from web browser
I am writing one program receives data files from the web browser. 我正在编写一个程序,该程序从Web浏览器接收数据文件。
HTML code: HTML代码:
<form action="http://192.168.0.102:8080/sync/uploadfile" method="post" enctype="multipart/form-data">
<input type="submit" value="Upload File"><br />
</form>
Data received: 收到的数据:
------WebKitFormBoundarysKV9CFx7LDIr5T1A Content-Disposition: form-data; name="uploadFile"; filename="icon.png" Content-Type: image/png xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ------WebKitFormBoundarysKV9CFx7LDIr5T1A--
I'm having problems when processing the data submitted from the browser. 处理浏览器提交的数据时遇到问题。
I want to convert the data to file. 我想将数据转换为文件。
Please help me how to solve problem. 请帮我解决问题。
when you receive the data as a string you could just call File.WriteAllText("Path","Data"); 当您以字符串形式接收数据时,可以只调用File.WriteAllText(“ Path”,“ Data”);
Edit: 编辑:
Please see this StackOverflow post: 请参阅此StackOverflow帖子:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.