Click here to Skip to main content
15,907,396 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to store zip file in specific location.user are not allowed to stored zip file, he can only upload zip file and system automatically store file at specfic location. below is my ocde



C#
private void button2_Click(object sender, EventArgs e)
      {
          OpenFileDialog open1 = new OpenFileDialog();
          // image filters
          open1.Filter = "Document Files(*.RAR)|*.RAR";
          if (open1.ShowDialog() == DialogResult.OK)
          {

              // document file path
              txtdocumentuploda.Text = open1.FileName;

          }
      }
Posted
Comments
Malli_S 17-Aug-12 7:42am    
What exactly is your problem ?
Manohar Khillare 17-Aug-12 7:43am    
i want uploaded file saved on specific location like "D:\\document\\
[no name] 17-Aug-12 7:48am    
Your vague question and your code have nothing to do with each other. If you want to save a file in a particular location then do it.
Bernhard Hiller 17-Aug-12 8:04am    
Please clarify:
"Upload" - is that a web application (e.g. asp)? Do you want to store the files on the server?
Or is everything running on one computer?

1 solution

1. Get the file name (You already have it)

2. Get the bytes of the file using the following link:

System.IO.File.ReadAllBytes[^]

3. Send the bytes of the file in a byte[] array and the file name to the uploaded server.

4. Write the bytes to the file in the path (The path you specified).
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900