Solved

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

Posted on 2013-01-21
4
2,181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 86

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 86

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

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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 datatypes, explain the available data types and show how data can be passed into and out of variables.
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.

691 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