|
|
@@ -170,32 +170,23 @@ namespace CallCenterApi.Interface.Controllers
|
|
170
|
170
|
HttpPostedFile _upFile = RequestString.GetFile("upFile");
|
|
171
|
171
|
if (_upFile != null)
|
|
172
|
172
|
{
|
|
173
|
|
- //string datename = DateTime.Now.ToString("yyyyMMddHHMMss");
|
|
174
|
|
- //string fullFileName = datename + "_" + _upFile.FileName;
|
|
175
|
|
- //string ffmpegLocation = Server.MapPath("~/");
|
|
176
|
|
- //string dirpath = Server.MapPath(this.Request.ApplicationPath + "\\auoupload");
|
|
177
|
|
- //string temp_filename = "";
|
|
178
|
|
- //if (!System.IO.Directory.Exists(dirpath))
|
|
179
|
|
- //{
|
|
180
|
|
- // System.IO.Directory.CreateDirectory(dirpath);
|
|
181
|
|
- //}
|
|
182
|
|
- //string path = this.Request.ApplicationPath + "/auoupload/" + fullFileName;
|
|
183
|
|
- //string physicalpath = Server.MapPath(path);
|
|
184
|
|
- //_upFile.SaveAs(physicalpath);
|
|
185
|
173
|
|
|
186
|
174
|
string datename = DateTime.Now.ToString("yyyyMMddHHMMss");
|
|
187
|
175
|
string fullFileName = datename + "_" + _upFile.FileName;
|
|
188
|
176
|
string ffmpegLocation = Server.MapPath("~/");
|
|
189
|
|
- string dirpath = Server.MapPath(this.Request.ApplicationPath + "\\auoupload");
|
|
190
|
|
- //string dirpath = Configs.GetValue("saveloc");
|
|
191
|
|
- if (!System.IO.Directory.Exists(dirpath))
|
|
|
177
|
+
|
|
|
178
|
+ #region 读取配置的上传路径-原文件和修改过格式的文件均上传至此
|
|
|
179
|
+ string savedir = Configs.GetValue("saveloc");
|
|
|
180
|
+ if (!System.IO.Directory.Exists(savedir))
|
|
192
|
181
|
{
|
|
193
|
|
- System.IO.Directory.CreateDirectory(dirpath);
|
|
|
182
|
+ System.IO.Directory.CreateDirectory(savedir);
|
|
194
|
183
|
}
|
|
195
|
|
- string path = this.Request.ApplicationPath + "/auoupload/" + fullFileName;
|
|
196
|
|
- //string physicalpath = dirpath + fullFileName;
|
|
197
|
|
- string physicalpath = Server.MapPath(path);
|
|
|
184
|
+ #endregion
|
|
|
185
|
+
|
|
|
186
|
+ #region 保存原文件
|
|
|
187
|
+ string physicalpath = Server.MapPath(savedir + fullFileName);
|
|
198
|
188
|
_upFile.SaveAs(physicalpath);
|
|
|
189
|
+ #endregion
|
|
199
|
190
|
|
|
200
|
191
|
#region 修改音频格式
|
|
201
|
192
|
if (!string.IsNullOrEmpty(physicalpath))
|
|
|
@@ -210,17 +201,11 @@ namespace CallCenterApi.Interface.Controllers
|
|
210
|
201
|
p.StartInfo.CreateNoWindow = true;
|
|
211
|
202
|
|
|
212
|
203
|
string temp_filename = physicalpath.Split('\\').Last().Split('.')[0] + "_temp";
|
|
213
|
|
- string savedir = Configs.GetValue("saveloc");
|
|
214
|
|
- if (!System.IO.Directory.Exists(savedir))
|
|
215
|
|
- {
|
|
216
|
|
- System.IO.Directory.CreateDirectory(savedir);
|
|
217
|
|
- }
|
|
218
|
|
-
|
|
|
204
|
+
|
|
219
|
205
|
p.Start();
|
|
220
|
206
|
p.StandardInput.WriteLine("cd " + ffmpegLocation);
|
|
221
|
207
|
p.StandardInput.WriteLine(ffmpegLocation.Split('\\').First());
|
|
222
|
208
|
p.StandardInput.WriteLine("ffmpeg.exe");
|
|
223
|
|
- //string changefile = "ffmpeg -i " + physicalpath + " -acodec pcm_u8 -ab 64 -ar 8000 -ac 1 " + dirpath + "\\" + temp_filename + ".wav";
|
|
224
|
209
|
string changefile = "ffmpeg -i " + physicalpath + " -acodec pcm_u8 -ab 64 -ar 8000 -ac 1 " + savedir + "\\" + temp_filename + ".wav";
|
|
225
|
210
|
p.StandardInput.WriteLine(changefile);
|
|
226
|
211
|
Thread.Sleep(3000);
|
|
|
@@ -239,7 +224,6 @@ namespace CallCenterApi.Interface.Controllers
|
|
239
|
224
|
upfile.ftpUserID = _acc;
|
|
240
|
225
|
upfile.ftpPassword = _pwd;
|
|
241
|
226
|
FileInfo fi = new FileInfo(physicalpath);
|
|
242
|
|
- //string uploadres = upfile.UploadLocalToFtp(dirpath + "\\" + temp_filename + ".wav");
|
|
243
|
227
|
string uploadres = upfile.UploadLocalToFtp(savedir + "\\" + temp_filename + ".wav");
|
|
244
|
228
|
if (uploadres == "上传成功!")
|
|
245
|
229
|
{
|
|
|
@@ -263,7 +247,6 @@ namespace CallCenterApi.Interface.Controllers
|
|
263
|
247
|
}
|
|
264
|
248
|
dModel.F_WavOldName = fullFileName;
|
|
265
|
249
|
dModel.F_WavNewName = temp_filename + ".wav";
|
|
266
|
|
- //dModel.F_WavPath = dirpath + "\\" + temp_filename + ".wav";
|
|
267
|
250
|
dModel.F_WavPath = savedir + "\\" + temp_filename + ".wav";
|
|
268
|
251
|
}
|
|
269
|
252
|
#endregion
|