Windows应用程序中的文件上载 [英] File Upload in windows application
问题描述
大家好,
我想将所选文件保存在Windows应用程序的其他文件夹中。
这里我想做什么。
我采取了一个OpenFileDialog。当我使用该对话框选择任何文件时,整个文件路径显示在文本框中,如下所示代码
Hi All,
I want to save selected file in other folder in windows application.
Here what i want to do.
I have taken one OpenFileDialog. When i select any file using that dialog, the whole file path shows in textbox as per below code
DialogResult result= openFileDialog1.ShowDialog();
textBox1.Text = openFileDialog1.FileName.ToString();
现在我还有一个带有上传标题的按钮。现在我想当我点击上传按钮时,我选择的文件应保存在我想要的另一个文件夹中(例如C:\ UpploadedImage \);
请任何人都可以在这个问题上帮助我。我真的需要它。
谢谢和问候
Suman Zalodiya
Now i have one other button with 'Upload' title. Now i want when i click on 'Upload' button my selected file should be save another folder where i wish(e.g. C:\UploadedImage\);
Please anyone can help me in this issue. I really need it.
Thanks and Regards
Suman Zalodiya
推荐答案
尝试此文件复制方法会将您的图像复制到新位置使用新名称
Try this file copy method will copy your image to new location with a new name
string fulllocimage = openFileDialog1.FileName;
File.Copy(fulllocimage, @"C:\UploadedImage\" + NewImageName);
最后我停下来
string fullpath = openDialog1.FileName;
string extension = Path.GetExtension(fullpath);
File.Copy(fullpath,@D:\ UploadedImages \+hello+ extension);
感谢大家的回复。
Finally i stop with
string fullpath=openDialog1.FileName;
string extension=Path.GetExtension(fullpath);
File.Copy(fullpath,@"D:\UploadedImages\" + "hello" + extension);
Thanks to all of you for reply.
这篇关于Windows应用程序中的文件上载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!