From 9ce8cb1ee053fb5ad4b51d724a5736e0e27ff0aa Mon Sep 17 00:00:00 2001 From: lu <99954486@qq.com> Date: 星期五, 23 五月 2025 09:10:52 +0800 Subject: [PATCH] 仓库 --- DevApp/Gs.DevApp/UserControl/UCUpFile.cs | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-) diff --git a/DevApp/Gs.DevApp/UserControl/UCUpFile.cs b/DevApp/Gs.DevApp/UserControl/UCUpFile.cs index 5fd57ad..93cfa75 100644 --- a/DevApp/Gs.DevApp/UserControl/UCUpFile.cs +++ b/DevApp/Gs.DevApp/UserControl/UCUpFile.cs @@ -1,16 +1,8 @@ -锘縰sing DevExpress.Utils.DirectXPaint; -using DevExpress.XtraEditors; -using Gs.DevApp.ToolBox; +锘縰sing Gs.DevApp.ToolBox; using System; -using System.Collections.Generic; -using System.ComponentModel; using System.Configuration; -using System.Data; -using System.Drawing; using System.IO; -using System.Linq; using System.Net.Http; -using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -25,7 +17,19 @@ btnUpSelect.Click += BtnUpSelect_Click; btnUp.Click += BtnUp_Click; } + + /// <summary> + /// 鐖朵翰guid + /// </summary> public string parentGuid + { + get; + set; + } + /// <summary> + /// 鍥剧墖鍒嗙粍锛屾瘮濡俵ogin,logo绛夊垎缁� + /// </summary> + public string parentGroup { get; set; @@ -49,7 +53,7 @@ // 璁剧疆鍒濆鐩綍 openFileDialog.InitialDirectory = "c:\\"; // 璁剧疆鏂囦欢杩囨护閫夐」锛屽锛�"鏂囨湰鏂囦欢 (*.txt)|*.txt|鎵�鏈夋枃浠� (*.*)|*.*" - openFileDialog.Filter = "鏂囨湰鏂囦欢 (*.txt)|*.txt|鎵�鏈夋枃浠� (*.*)|*.*"; + openFileDialog.Filter = "鎵�鏈夋枃浠� (*.*)|*.*"; // 璁剧疆鏍囬 openFileDialog.Title = "閫夋嫨鏂囦欢"; // 鏄剧ず瀵硅瘽妗� @@ -69,7 +73,7 @@ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> - private async void BtnUp_Click(object sender, EventArgs e) + private async void BtnUp_Click(object sender, EventArgs e) { var WebApiUrl = ConfigurationSettings.AppSettings.Get("WebApiUrl"); var address = WebApiUrl + "MesFile/UploadFile"; @@ -84,9 +88,8 @@ if (UpChanged != null) UpChanged(this, e); } - private async Task UploadFileAsync(string url, string filePath) + private async Task UploadFileAsync(string url, string filePath) { - string _parentGuid = parentGuid; using (var httpClient = new HttpClient()) try @@ -98,7 +101,7 @@ using (var fs = File.OpenRead(filePath)) using (var streamContent = new StreamContent(fs)) { - form.Add(streamContent, "file", _parentGuid + "~" + Path.GetFileName(filePath)); + form.Add(streamContent, "file", _parentGuid + "~" + Path.GetFileName(filePath) + "~" + parentGroup); var response = await httpClient.PostAsync(url, form); var responseString = await response.Content.ReadAsStringAsync(); @@ -110,9 +113,7 @@ catch (Exception ex) { Gs.DevApp.ToolBox.MsgHelper.ShowError(ex.Message); - } - } #endregion -- Gitblit v1.9.3