Solved

save image in the folder in  root in vb.net windows application

Posted on 2013-01-21
4
1,969 Views
Last Modified: 2013-02-07
how to save image in the folder in  root in vb.net windows application ?
0
Comment
Question by:mohgt
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
brendanmeyer earned 125 total points
ID: 38800791
just use the file name and dont include a path
eg:
Image.save("picture.jpg")
instead of
Image.save("c:\windows\files\picture.jpg")
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 250 total points
ID: 38802071
You can use Application.StartupPath():
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.startuppath.aspx

    "Gets the path for the executable file that started the application, not including the executable name."
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 250 total points
ID: 38802084
*Though on Vista and higher, this will probably require elevated permissions.  It's usually a better idea to use the Environment.SpecialFolder Enumeration:
http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx

    ApplicationData --> The directory that serves as a common repository for application-specific data for the current roaming user.  A roaming user works on more than one computer on a network. A roaming user's profile is kept on a server on the network and is loaded onto a system when the user logs on.

See Environment.GetFolderPath():
http://msdn.microsoft.com/en-us/library/14tx8hby.aspx
0
 
LVL 10

Assisted Solution

by:Monica P
Monica P earned 125 total points
ID: 38804375
Get The base location

 Dim base As String = AppDomain.CurrentDomain.BaseDirectory

 Dim Filename as string="test.jpeg"

   base = base + Filename   ---> (contain entire filename )

Sample Code to save image

protected void btnSubmit_Click(object sender, EventArgs e)
{
//Get Filename from fileupload control
string filename = Path.GetFileName(fileuploadimages.PostedFile.FileName);

//Save images into Images folder

fileuploadimages.SaveAs(Server.MapPath("Images/"+filename));
                                           or
fileuploadimages.SaveAs((base ));
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now