[英]upload audio recording to ftp
I need to upload audio files recorded from my application .I am unable to upload aac files to ftp. 我需要上传从我的应用程序录制的音频文件。我无法将aac文件上传到ftp。 Here is my code to upload
这是我要上传的代码
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(myftppath);
ftp.Credentials = new NetworkCredential(username,password);
ftp.UseBinary = true;
ftp.Method = WebRequestMethods.Ftp.UploadFile;
FileStream fs = File.OpenRead(audioFilePath);
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();
Stream ftpstream = ftp.GetRequestStream();
ftpstream.Write(buffer, 0, buffer.Length);
ftpstream.Close();
ftpstream.Flush();
The code works for uploading other files like txt,png,mp3 etc but not for aac files. 该代码适用于上传其他文件,如txt,png,mp3等,但不适用于aac文件。 Please help
请帮忙
Your code seems to be correct. 你的代码似乎是正确的。 You may try this,
你可以试试这个,
If none works then find out the exact cause of error using try block. 如果没有工作,那么使用try块找出错误的确切原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.