C# 利用webclient POST从winform客户端上传不同类型的两个文件至服务端如何实现? 50
eg.准备上传的两个文件是.jpg和.docC#里这部分的代码差不多就是: WebClientwebclient=newWebClien...
eg.准备上传的两个文件是.jpg和.doc
C#里这部分的代码差不多就是:
WebClient webclient = new WebClient();
byte[] responseArray1 = webclient.UploadFile("http://localhost/upload.aspx ", "POST", @"" + fileName1 + "");
byte[] responseArray2 = webclient.UploadFile("http://localhost/upload.aspx ", "POST", @"" + fileName2 + "");
......
......
在aspx中对文件名的设置:
HttpPostedFile file = Request.Files[f];
Random seed = new Random();
int randomNum = seed.Next(10, 99);
string fileName = DateTime.Now.ToString("HHmmss") + randomNum.ToString() + ".拓展名";
请问在这里".拓展名"如何设置让原来.jpg的文件还是.jpg,原来.doc的文件还是.doc 展开
C#里这部分的代码差不多就是:
WebClient webclient = new WebClient();
byte[] responseArray1 = webclient.UploadFile("http://localhost/upload.aspx ", "POST", @"" + fileName1 + "");
byte[] responseArray2 = webclient.UploadFile("http://localhost/upload.aspx ", "POST", @"" + fileName2 + "");
......
......
在aspx中对文件名的设置:
HttpPostedFile file = Request.Files[f];
Random seed = new Random();
int randomNum = seed.Next(10, 99);
string fileName = DateTime.Now.ToString("HHmmss") + randomNum.ToString() + ".拓展名";
请问在这里".拓展名"如何设置让原来.jpg的文件还是.jpg,原来.doc的文件还是.doc 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询