问题描述
- C#上传文件时找不到文件~求解~!!
- //后台代码
public static class Qiniu_API
{
public static string Bucket = """";//空间名
public static string Domain = """";//域名static Qiniu_API() { Config.ACCESS_KEY = ""<AK>""; //AK Config.SECRET_KEY = ""<SK>"";//SK } public static void ResumablePutFile(string bucket string key string fname) { Console.WriteLine(""n===> ResumablePutFile {0}:{1} fname:{2}"" bucket key fname); PutPolicy policy = new PutPolicy(bucket 3600); string upToken = policy.Token(); Settings setting = new Settings(); ResumablePutExtra extra = new ResumablePutExtra(); ResumablePut client = new ResumablePut(setting extra); client.PutFile(upTokenfname key); }}protected void confirm_Click(object sender EventArgs e){ HttpFileCollection collection = HttpContext.Current.Request.Files; HttpPostedFile file = collection[0]; string bucket = ""maitian""; Qiniu_API.ResumablePutFile(bucket null file.value);} 点击后显示:
解决方案
检查下文件路径,另外中文文件名编码是否正确
时间: 2024-10-31 10:06:29