Esempio n. 1
0
        public static string UploadImages(string img1, string img2)
        {
            string text3;
            string text2;
            string text;
            string text4 = text3 = (text2 = (text = ""));

            if (!string.IsNullOrEmpty(img1))
            {
                text4 = StaticCalls.GetName();
                if (!string.IsNullOrEmpty(img2))
                {
                    text3 = StaticCalls.GetName();
                }
                if (HttpContext.Current != null)
                {
                    text2 = HttpContext.Current.Server.MapPath("~/Property_Images/") + text4 + ".jpg";
                    text  = HttpContext.Current.Server.MapPath("~/Property_Images/") + text3 + ".jpg";
                }
                else
                {
                    text2 = HostingEnvironment.MapPath("~/Property_Images/") + text4 + ".jpg";
                    text  = HostingEnvironment.MapPath("~/Property_Images/") + text3 + ".jpg";
                }
                StaticCalls.send_text("Local Path 1: " + text2);
                StaticCalls.send_text("Local Path 2: " + text);
                using (WebClient webClient = new WebClient())
                {
                    try
                    {
                        webClient.DownloadFile(img1, text2);
                        StaticCalls.send_text(img1 + " Uoloaded to: " + text2);
                        webClient.DownloadFile(img2, text);
                        StaticCalls.send_text(img2 + " Uoloaded to: " + text2);
                    }
                    catch (Exception)
                    {
                        return("NULL");
                    }
                }
                return(text4 + ".jpg|" + ((!string.IsNullOrEmpty(text3)) ? (text3 + ".jpg|") : ""));
            }
            return("NULL");
        }