c# - How to give path of a folder in server to save an image? -


i'm trying store image 2 applications (both published on server). code save image :

 string path = server.mappath("/images/landing/bottom_banner/");             string path1 = @"_http://10.241.193.22/myapplication/images/landing/bottom_banner/";   httppostedfilebase photo = request.files["adup"];             if (photo.contentlength != 0)             {                 string lastpart = photo.filename.split('\\').last();                 random random = new random();                 int rno = random.next(0, 1000);                 photo.saveas(path + rno + lastpart);                 photo.saveas(path1 + rno + lastpart);             } 

note: myapplication application hosted on same server

my problem able save image in first application using server.mappath when compiler comes part photo.saveas(path1 + rno + lastpart) gives error:

the saveas method configured require rooted path, , path '_http://10.241.193.22/myapplication/images/landing/bottom_banner/676chrysanthemum.jpg' not rooted

please suggest how can eliminate issue?

i not sure whether right can ?

in current application store server.mappath value , replace current application name "myapplication" , add trailing path. this

string path1 = server.mappath(""); path1.replace("application1", "myapplication"); //considering "application1" name of current application path1 += "/images/landing/bottom_banner/"; httppostedfilebase photo = request.files["adup"];         if (photo.contentlength != 0)         {             string lastpart = photo.filename.split('\\').last();             random random = new random();             int rno = random.next(0, 1000);             photo.saveas(path1 + rno + lastpart);         } 

there might permission problem one. have not checked it. if works please let me know.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -