 |
| Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 10th, 2009, 11:31 AM
|
|
Registered User
|
|
Join Date: May 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
I need help saving an retriving files to a Local disk
Hello Everyone:
I am new in programming and I need some assistance on saving and retriving files to a local drive. I am using VB2005
I have created a project that allows the user to add a new record, sometimes, the user needs to add backup, this could be a word, txt, pdf, picture, any file type.
I would like to give the user an option to OpenFileDialog and select a file and then save it to a local drive. example C:\Program Files\Support\Attachments. I will be adding a link on the form with the file name.. when someone else edit that record and clicks on the lick to be able to view the file.
I thank evryone in advance.
BK
|
|

March 10th, 2009, 11:58 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
Hi there..
You are looking for IO namespace. You have there all the info about saving, retrieving, and working with files (and folder, and disk). Also for the File Dialog, you have the control File dialog that allow you to specify the name of the file (with the folder and all the standard window behaviour).
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

March 10th, 2009, 12:09 PM
|
|
Registered User
|
|
Join Date: May 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Thank you gbianchi
Do you happen to know where I can find some sample code is possible?
Thanks,
again
|
|

March 10th, 2009, 12:14 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
Thanks button is bottom right ;).. Anyway, MSDN on line has a lot of resources about it. (also google has a lot, lot of examples about it).
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|
The Following User Says Thank You to gbianchi For This Useful Post:
|
|
|

March 10th, 2009, 12:27 PM
|
|
Registered User
|
|
Join Date: May 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Thank you much :-)
|
|

April 2nd, 2009, 12:22 AM
|
|
Authorized User
|
|
Join Date: Mar 2009
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi,
Try it
Code:
If FileUpload1.FileName <> "" Then
FileUpload1.SaveAs(MapPath("~/userimages/" & txtUName.Value & System.IO.Path.GetExtension(FileUpload1.FileName)))
End If
where "userimages" -- is the folder on server/local disk
"txtUName.Value" -- will file name
"System.IO.Path.GetExtension(FileUpload1.FileName) "-- Extension of file
|
|
 |