开发者

How to copy and save an audio file using c#?

开发者 https://www.devze.com 2022-12-18 09:59 出处:网络
i want to copy and paste a audio file using c#?开发者_如何学Python Int32 intAudioSize = 0; string strAudioType = null;

i want to copy and paste a audio file using c#?开发者_如何学Python

    Int32 intAudioSize = 0;
    string strAudioType = null;
    Stream AudioStream = null;

    // Gets the Size of the Audio
    intAudioSize = FileUpload1.PostedFile.ContentLength;

    // Gets the Audio Type
    strAudioType = FileUpload1.PostedFile.ContentType;

    // Reads the Audio
    AudioStream = FileUpload1.PostedFile.InputStream;


You can use the File.Copy method.

See Copy, Delete, and Move Files and Folders

Edit

To your edited question.

You can use HttpPostedFile.SaveAs Method

for saving a file that is selected using the <input type="file" /> control


Well if you are not going to do anything with it use File.Copy

This is how it works for all kind of files : File.Copy("source", "destination");

and you should reference System.IO


Use File.Copy:

File.Copy("file-from.mp3", "file-to.mp3");


What about FileUpload.SaveAs("file.ext");

See MSDN's FileUpload page

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号