Procházet zdrojové kódy

IVR上传部分已正常

zhengbingbing %!s(int64=6) %!d(string=před) roky
rodič
revize
e454c79c33

+ 4 - 1
Web/App_Code/UPloadFile.cs

@@ -11,6 +11,7 @@ using System.Web;
11 11
 public class UPloadFile
12 12
 {
13 13
     public string ftpPath;
14
+    public string ftpdir;
14 15
     public string ftpUserID;
15 16
     public string ftpPassword;
16 17
 
@@ -34,6 +35,8 @@ public class UPloadFile
34 35
         //FileInfo fileInfAft = new FileInfo(localfileAft);
35 36
         #endregion
36 37
         string ftpURI = "ftp://" + ftpPath + "/";
38
+        if (!string.IsNullOrEmpty(ftpdir))
39
+            ftpURI = ftpURI + ftpdir + "/";
37 40
         string uri = ftpURI + fileInf.Name;
38 41
         //string uriAft = ftpURI + fileInfAft.Name;
39 42
         FtpWebRequest reqFTP;
@@ -56,7 +59,7 @@ public class UPloadFile
56 59
         {
57 60
             try
58 61
             {
59
-                res += uri + localFile;
62
+                res += uri;// + localFile;
60 63
                 using (Stream strm = reqFTP.GetRequestStream())// 把上传的文件写入流
61 64
                 {
62 65
                     //StreamReader strm = new StreamReader(fs, System.Text.Encoding.Default);

+ 1 - 0
Web/IVRConfig/UploadIVR.aspx

@@ -237,6 +237,7 @@
237 237
                                                                                         <td style="padding-top: 5px">
238 238
                                                                                             <div style="padding-top: 2px">
239 239
                                                                                                 <asp:FileUpload ID="fileupload" runat="server" CssClass="txt" />
240
+                                                                                                <asp:Label ID="lblfilepath" Visible="false" runat="server"></asp:Label>
240 241
                                                                                             </div>
241 242
                                                                                         </td>
242 243
                                                                                     </tr>

+ 20 - 8
Web/IVRConfig/UploadIVR.aspx.cs

@@ -63,22 +63,27 @@ public partial class IVRConfig_UploadIVR : System.Web.UI.Page
63 63
             string localPath = Server.MapPath(Path.Combine(HttpRuntime.AppDomainAppPath, path));
64 64
             string ex = Path.GetExtension(file.FileName);
65 65
             string oriname = Path.GetFileNameWithoutExtension(file.FileName);
66
-            filePathName = oriname + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ex;
66
+            //filePathName = oriname + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ex;
67
+            lblfilepath.Text += "localPath"+ localPath;
68
+            filePathName = oriname + ex;
67 69
             if (!System.IO.Directory.Exists(localPath))
68 70
             {
69 71
                 System.IO.Directory.CreateDirectory(localPath);
70 72
             }
71 73
             string physicalpath = Path.Combine(localPath, filePathName);
72 74
             file.SaveAs(physicalpath);
75
+            lblfilepath.Text += "|||222";
73 76
             #endregion
74 77
             #region 读取配置的上传路径-原文件和修改过格式的文件均上传至此
75
-            if (!System.IO.Directory.Exists(dir))
76
-            {
77
-                System.IO.Directory.CreateDirectory(dir);
78
-            }
78
+            //if (!System.IO.Directory.Exists(dir))
79
+            //{
80
+            //    System.IO.Directory.CreateDirectory(dir);
81
+            //}
79 82
             #endregion
83
+            lblfilepath.Text += "|||333dir"+ dir;
80 84
             if (!string.IsNullOrEmpty(physicalpath))
81 85
             {
86
+                lblfilepath.Text += "|||physicalpath"+physicalpath;
82 87
                 #region 上传到ftp
83 88
                 UPloadFile upfile = new UPloadFile();
84 89
                 //通过读取配置文件,获取数据库
@@ -89,6 +94,7 @@ public partial class IVRConfig_UploadIVR : System.Web.UI.Page
89 94
                 upfile.ftpPath = _ftp;
90 95
                 upfile.ftpUserID = _acc;
91 96
                 upfile.ftpPassword = _pwd;
97
+                upfile.ftpdir = dir;
92 98
                 string uploadBeforres = upfile.UploadLocalToFtp(physicalpath);
93 99
                 #endregion
94 100
                 if (uploadBeforres.Equals("上传成功!"))
@@ -136,8 +142,14 @@ public partial class IVRConfig_UploadIVR : System.Web.UI.Page
136 142
 
137 143
     protected void btnSave_ServerClick(object sender, EventArgs e)
138 144
     {
139
-        var res=UpLoadProcess(ddlType.SelectedValue, this.fileupload);
140
-        GetFileList(ddlType.SelectedValue);
141
-        Page.ClientScript.RegisterStartupScript(GetType(), "confirm", "OpenMessage('framemessage', '提示', '" + res + "', 200, 30);", true);
145
+        if (this.fileupload.FileName != "")
146
+        {
147
+            var res = UpLoadProcess(ddlType.SelectedValue, this.fileupload);
148
+            
149
+            Page.ClientScript.RegisterStartupScript(GetType(), "confirm", "OpenMessage('framemessage', '提示', '" + res + "', 200, 80);", true);
150
+            GetFileList(ddlType.SelectedValue);
151
+        }
152
+        else
153
+            Page.ClientScript.RegisterStartupScript(GetType(), "confirm", "OpenMessage('framemessage', '提示', '请选择文件!', 200, 80);", true);
142 154
     }
143 155
 }

+ 1 - 1
Web/_framepage/headframe_new.aspx

@@ -9,7 +9,7 @@
9 9
     <script type="text/javascript" src="../seatformjs/ocxopt.js"></script>
10 10
     <script src="../seatformjs/formopt.js" type="text/javascript"></script>
11 11
 </head>
12
-<body onload="Init();"  style="background: url(../images/bg4.png) repeat-x;"><!--style="background: url(images/bg2.png) repeat-x;"-->
12
+<body onload="Init();"  style="background: url(images/bg2.png) repeat-x;"><!--style="background: url(../images/bg4.png) repeat-x;">-->
13 13
     <form id="form1" runat="server">
14 14
         <asp:HiddenField ID="ismonitoring" runat="server" Value="false" />
15 15
         <!-- 是否具有话务功能,是否坐席登录 -->