Hi
I have a solution file that consist of two different projects.
In one of the projects i have a code to upload the file and save it.

Currently the file is saved in same project directory that consist of code to upload the file.

I want to upload the file in other project directory.

Is it possible.

I am developing the application in asp.net mvc.

Please help

Recommended Answers

All 3 Replies

Hello there

If i understand you correcly!!!
suppose you have classes class1 & class2 in each project A & Project B

if you want to use class1 of project A in Project B's class2
Then right click on project 2 >> References>>Add Reference>>"Select Class1 dll of project A"

Then in class 2 of project B inherit like the class1 like this
VB

Imports Project1.Class1

C#

Using Project1.Class1

Mark as solved if it helps you!!!

the conditon is as you have said. but i have image upload code in a project A, i want to save the uploaded image to folder in projectB.

It's not about class, that i know just adding the reference will do, but this is something different.

Ok i solved the problem:

1. string temp = Server.MapPath(Request.ApplicationPath);
2. string tempPath = Path.Combine(temp.Substring(0, (temp.Length - 21)), "IManageProject\\Images");
3. filePath = Path.Combine(tempPath, Path.GetFileName(fileName));
4. file.SaveAs(filePath);

I i just got the path to the root of the project using the code in line 1.
Then is used the substring on temp variable and got the path to the root and then finally combined it with the path to the folder i wanted.
and save the file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.