---
title: "Saving a file to project folder and save its path"  
description: "Saving a file to project folder and save its path"  
author: "Anonymous User"  
published: 2013-09-28  
updated: 2013-09-28  
canonical: https://www.mindstick.com/forum/1573/saving-a-file-to-project-folder-and-save-its-path  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Saving a file to project folder and save its path

I am using [visual studio](https://www.mindstick.com/articles/12378/visual-studio-for-mac-is-out-of-beta-preview-now-officially-available) 2010 (c#).

I would like to [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) a [zip](https://www.mindstick.com/interview/34182/compress-old-log-files-e-g-zip-after-7-days) or rar [file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp) from my computer, save it to [project](https://www.mindstick.com/articles/105927/how-to-excel-at-managing-multiple-projects) folder and [store](https://www.mindstick.com/articles/13125/tips-to-increase-sales-of-your-woocommerce-store) its [path](https://www.mindstick.com/articles/44333/4-expert-tips-on-how-to-pick-the-right-career-path) to a variable.

I tried [openfiledialog](https://www.mindstick.com/forum/1564/use-openfiledialog-to-get-path-of-open-database-c-sharp)() but I couldn't solve it this way.

How can I do that?

## Replies

### Reply by Anonymous User

Hey Ida!

```
private void button1_Click(object sender, EventArgs e)        {
             var openFileDialog=new OpenFileDialog {Filter = @"Zip Files|*.zip|RAR Files|*.rar|All Files|*.*"};
            if (DialogResult.OK == openFileDialog.ShowDialog())
            {
                File.Copy(openFileDialog.FileName, Application.StartupPath + @"\"
                    + Path.GetFileName(openFileDialog.FileName));
                yourvariable = Application.StartupPath + @"\"
                               + Path.GetFileName(openFileDialog.FileName);
            }
        }
```

\

your file will be copied to yourprojectname\yourprojectname\bin\Debug\


---

Original Source: https://www.mindstick.com/forum/1573/saving-a-file-to-project-folder-and-save-its-path

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
