Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
|
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
 
Old March 10th, 2009, 11:31 AM
Registered User
 
Join Date: May 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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
 
Old March 10th, 2009, 11:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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.
================================================== =========
 
Old March 10th, 2009, 12:09 PM
Registered User
 
Join Date: May 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you gbianchi

Do you happen to know where I can find some sample code is possible?
Thanks,
again
 
Old March 10th, 2009, 12:14 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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:
BlackKnight (March 10th, 2009)
 
Old March 10th, 2009, 12:27 PM
Registered User
 
Join Date: May 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you much :-)
 
Old April 2nd, 2009, 12:22 AM
Authorized User
 
Join Date: Mar 2009
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving a document on local computer h2c357 Javascript 0 May 3rd, 2007 09:14 AM
Retrieving image from sql and saving to disk otsthebus Classic ASP Basics 1 August 5th, 2006 01:51 AM
How to search whole disk for .doc files? bcmaverik VB.NET 2002/2003 Basics 2 February 18th, 2004 09:25 AM
Restoring Files from a Disk Device Bob Bedell SQL Server 2000 2 October 5th, 2003 06:33 PM
Dealing with local files Ray Pinnegar Beginning PHP 4 July 24th, 2003 03:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.