[英]Saving video file in a Specific Folder : Windows Form Application C#
Hey guys uhm well as you can see i'm having trouble saving a video file because some answers in some threads here doesn't suggest that a video file should be saved in a database because it will only prolong the process, so the point here is that i'm trying to save a video file from a specific folder. 大家好,您可以看到我在保存视频文件时遇到了麻烦,因为此处某些线程中的某些答案并不表明应该将视频文件保存在数据库中,因为这只会延长过程,所以这里的重点是我正在尝试从特定文件夹保存视频文件。 im not that used to "savefiledialog" function yet but i'm doing reseaches about it, 即时消息不是以前用来“ savefiledialog”功能的消息,但是我正在研究它,
i just need to know if it is possible to create the same video file and save it as a new copy with a different name using savefiledialog. 我只需要知道是否可以创建相同的视频文件,并使用savefiledialog将其另存为新的副本。
Here's the sample of my form pre 这是我表格的样本
thanks for your response guys if there's one 感谢您的回复,如果有一个
You can use System.IO.File.Copy
to copy file from a source to destination. 您可以使用System.IO.File.Copy
将文件从源复制到目标。 For example: 例如:
var sourceFile=@"d:\video.avi";
var saveFileDialog = new SaveFileDialog();
//You can offer a default name
saveFileDialog.FileName = "video-copy.avi";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
System.IO.File.Copy(sourceFile, saveFileDialog.FileName);
}
If destination file exists, you will receive an exception. 如果目标文件存在,您将收到一个例外。 You can check for file existence using System.IO.File.Exists
or you can overwrite the destination file using System.IO.File.Copy(source, destination, true)
. 您可以使用System.IO.File.Exists
检查文件是否存在,也可以使用System.IO.File.Copy(source, destination, true)
覆盖目标文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.