upload file in asp.net

i create subdomain admin.mywebsite.com
i want to upload file
from this domain to my main domain
www.mywebsite.com 's image folder
how i do this
LVL 5
chandresh43Asked:
Who is Participating?
 
govindarajan78Connect With a Mentor Commented:
1 . store the absolute path ex(d:\site\mainsite\images) in the upload program

you also can store that path in the web.config

2. if the sites are in different machine then you have to write program to post the image to the to main site and from main site read and store the value
0
 
chandresh43Author Commented:
where i find this path
i make not hosting
my website on host server
what is default path that i save
0
 
Muhammad Ousama GhazaliSolution Analyst & ArchitectCommented:
Contact your web hosting company and ask for this information such as Absolute Path to your Main and Sub Domain and try using it as suggested by govindarajan78.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
chandresh43Author Commented:
I TRY IT BUT IT GIVE ME ERROR
c:/Inetpub/vhosts/MYDOMAIN/httpdocs/images/Diamond-Ring/Engagement-Ring/
IS NOT not a valid virtual path.
0
 
Muhammad Ousama GhazaliSolution Analyst & ArchitectCommented:
1. Try putting "\" instead of "/" in your path.
2. Please post the full actual error message/detail you get to have a better assitance.
0
 
Muhammad Ousama GhazaliConnect With a Mentor Solution Analyst & ArchitectCommented:
3. Confirm with your hoster if the Network Service and/or ASPNET user have the Write/Modify permissions on that folder?
0
 
govindarajan78Commented:
print the server.mappath in the subdomain ; that will show the physical path
0
 
chandresh43Author Commented:
it show c:/Inetpub/vhosts/MYDOMAIN/httpdocs
this path
0
 
Kumaraswamy RCommented:
Hi

My suggestion

step 1: in the web.config file give the File Path

step 2: In the Server side get / Read the file path information from the Web.config
 
step 3: Check the folder exist , else create

Step 4: Save the File

Sample coding


                    if (!System.IO.Directory.Exists(sPath))
                        System.IO.Directory.CreateDirectory(sPath);
                    if (btnFileBrowse.Value != "")
                                string path = sPath + sPDF_FileName + fileextension;
                    btnFileBrowse.PostedFile.SaveAs(path.ToString());
                                        FileUploadstatus = "Success";
                   
0
 
govindarajan78Commented:
before proceeding:
check
what
moghazali said

moghazali:
3. Confirm with your hoster if the Network Service and/or ASPNET user have the Write/Modify permissions on that folder?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.