private void uploadFile() { //上传文件 if (selectedFile == null) { MessageBox.Show("不存在的文件,请重新选择", "提示", MessageBoxButtons.OK); } buttonUpload.Enabled = false; buttonChoiceFile.Enabled = false; string path = OssContants.OSSPATH[comboBox1.Text] != null ? OssContants.OSSPATH[comboBox1.Text].ToString() : ""; string res = OssUtils.upload(path, selectedFile); if (res != null) { res = OssConfig.BucketDomain + res; Logger.Instance.Info(res); processControl1.complete(); MessageBox.Show("上传成功!点击确认后自动复制到剪切板", "上传结果", MessageBoxButtons.OK); Clipboard.SetText(res); //清空已经上传的选择文件,防止重复上传 buttonUpload.Enabled = false; selectedFile = null; } else { MessageBox.Show("上传失败!请查看失败原因进行重试,多次失败请联系管理员", "上传结果", MessageBoxButtons.OK); } buttonChoiceFile.Enabled = true; }