[英]Saving a media player video in the folder
Good Day sir, I have a project of a Media Player that can save a Video in a folder. 早上好先生,我有一个Media Player项目,可以将视频保存在文件夹中。 I made a button that can browse a files so i use the openfiledialog and after choosing a video, the file path of a video is in the textbox that i made so this is my codes:
我做了一个可以浏览文件的按钮,所以我使用openfile对话框,选择视频后,视频的文件路径在我创建的文本框中,所以这是我的代码:
private void button3_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
this.textBox1.Text = openFileDialog1.FileName;
}
}
My problem is the video that i selected is I want it to save in the folder that i named (savevideo). 我的问题是我选择的视频是否要保存在我命名的文件夹中(保存视频)。 Can you help me with this?
你能帮我吗?
I think you need something like this: 我认为您需要这样的东西:
private void button3_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
this.textBox1.Text = openFileDialog1.FileName;
File.Copy(openFileDialog1.FileName,
Path.Combine(savevideo, Path.GetFileName(openFileDialog1.FileName)));
}
}
The Path.Combine bit builds you new file name to copy to, based on combining your 'savevideo' path, and the name of the original file. Path.Combine位基于“ savevideo”路径和原始文件名的组合,为您创建要复制到的新文件名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.