Approved: Fortect
Here are some simple steps that can help you solve the file upload code issue in your C # Windows application.
Homeless Hedgehog csharp May 5, 2020 Comment
csharp by – Medium Battleship in May 2007 2021 Comment
HeyHow do I load my document from the server path when I click a button C # – Windows Application
my download code:
DialogResult = openFileDialog1.ShowDialog (); If (result == DialogResult.OK) // test result. Integer = 0; string [] filename; foreach (string element in openFileDialog1.FileNames) Filename = item.Split (''); File.Copy (element, @ "C: Users samer Desktop Files " + filename [filename.Length - 1]); account ++;
line filepath = @ “C: Users samer Desktop Files image100.png”;
FS = new system file stream (file path, .IO.FileMode.Create);
FS.Close ();
You should clean up a little.Put your code and use the correct methods mentioned in the comments.
DialogResult = openFileDialog1.ShowDialog ();if (result == DialogResult.OK) // test result. chain path Destination path = .Combine (Environment.GetFolderPath (Environment.SpecialFolder. "Files"); desktopdirectory), foreach (string element in openFileDialog1 filenames.) File.Copy (Element, Path.Combine (PathDestination, Path.GetFileName (Element)));
This code should work if you have the correct permissions.
You used the file.copy clause in your case ( you can call the concept a download file, but this is actually a special copy action ), but if the server list ( source directory ) SHARED so only this tool will work for you, but if your payload directory is not shared you need to use the WebClient.DownloadFile () method (which will download the resource offer to the city file with the given URI)
see link below for more details
WebClient.DownloadFile Method (String, String) (System.Net) [^]
This content, as well as all source numbers and related files are found I am licensed under The Code Project Open License (CPOL).
Top Experts | |
Last 24 Hours | This Month |
Speed up your computer's performance now with this simple download.