Esempio n. 1
0
 protected void btnUpload_Click(object sender, EventArgs e)
 {
     if (fpImage.HasFile)
     {
         string fileName = Path.GetFileNameWithoutExtension(fpImage.FileName) + DateTime.Now.Ticks.ToString() + Path.GetExtension(fpImage.FileName);
         fpImage.SaveAs(MapPath(newsMainPath + fileName));
         ocommon.CreateThumbnail1("uploads\\news\\", newsImageFrontWidth, newsImageFrontHeight, "~/uploads/news/water/", fileName);
         //WatermarkImageCreate(fileName);
         imgNews.Visible       = true;
         imgNews.ImageUrl      = newsMainPath + fileName;
         ViewState["fileName"] = fileName;
         btnRemove.Visible     = true;
         btnUpload.Visible     = false;
     }
 }
Esempio n. 2
0
 protected void btnImages_Click(object sender, EventArgs e)
 {
     if (fpImage.HasFile)
     {
         string fileName = Path.GetFileNameWithoutExtension(fpImage.FileName.Replace(' ', '_')) + DateTime.Now.Ticks.ToString() + Path.GetExtension(fpImage.FileName);
         fpImage.SaveAs(MapPath(productMainPath + fileName));
         ocommon.CreateThumbnail1("uploads\\product\\", productImageFrontWidth, productImageFrontHeight, "~/Uploads/product/water/", fileName);
         WatermarkImageCreate(fileName);
         productimagesvideos objproductimagesvideos = new productimagesvideos();
         objproductimagesvideos.pid            = Convert.ToInt64(ocommon.Decrypt(Convert.ToString(Request.QueryString["id"]), true));
         objproductimagesvideos.imagevideoname = txtImageName.Text.Trim();
         objproductimagesvideos.imagevideopath = fileName;
         Int64 Result = (new Cls_productimagesvideos_b().Insert(objproductimagesvideos));
         bMessage.Visible = true;
         if (Result > 0)
         {
             txtImageName.Text  = string.Empty;
             bMessage.InnerHtml = "Image Inserted Successfully...";
         }
         else
         {
             bMessage.InnerHtml = "Image Not Inserted...";
         }
         BindImagesUsingProductId(Convert.ToInt64(objproductimagesvideos.pid));
     }
 }
Esempio n. 3
0
 protected void btnImageUpload_Click(object sender, EventArgs e)
 {
     if (fpCategory.HasFile)
     {
         string fileName = Path.GetFileNameWithoutExtension(fpCategory.FileName.Replace(' ', '_')) + DateTime.Now.Ticks.ToString() + Path.GetExtension(fpCategory.FileName);
         fpCategory.SaveAs(MapPath(categoryMainPath + fileName));
         ocommon.CreateThumbnail1("uploads\\agent\\", categoryImageFrontWidth, categoryImageFrontHeight, "~/Uploads/agent/front/", fileName);
         imgCategory.Visible    = true;
         imgCategory.ImageUrl   = categoryFrontPath + fileName;
         ViewState["fileName"]  = fileName;
         btnRemove.Visible      = true;
         btnImageUpload.Visible = false;
     }
 }
 protected void btnImageUpload_Click(object sender, EventArgs e)
 {
     if (fpCategory.HasFile)
     {
         string fileName = Path.GetFileNameWithoutExtension(fpCategory.FileName) + DateTime.Now.Ticks.ToString() + Path.GetExtension(fpCategory.FileName);
         fpCategory.SaveAs(MapPath(offerMainPath + fileName));
         ocommon.CreateThumbnail1("uploads\\offer\\", offerImageFrontWidth, offerImageFrontHeight, "~/Uploads/offer/water/", fileName);
         //WatermarkImageCreate(fileName);
         imgCategory.Visible    = true;
         imgCategory.ImageUrl   = offerMainPath + fileName;
         ViewState["fileName"]  = fileName;
         btnRemove.Visible      = true;
         btnImageUpload.Visible = false;
     }
 }
    //protected override void Render(HtmlTextWriter writer)
    //{
    //    string validatorOverrideScripts = "<script src=\"" + Page.ResolveUrl("~") + "js/validators.js\" type=\"text/javascript\"></script>";
    //    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ValidatorOverrideScripts", validatorOverrideScripts, false);
    //    base.Render(writer);
    //}

    protected void btnImageUpload_Click(object sender, EventArgs e)
    {
        if (fpfarmer.HasFile)
        {
            //OnClientClick = "return checkFileExtension()"

            string fileName = Path.GetFileNameWithoutExtension(fpfarmer.FileName.Replace(' ', '_')) + DateTime.Now.Ticks.ToString() + Path.GetExtension(fpfarmer.FileName);
            fpfarmer.SaveAs(MapPath(FarmerMainPath + fileName));
            ocommon.CreateThumbnail1("uploads\\farmers\\", categoryImageFrontWidth, categoryImageFrontHeight, "~/uploads/farmers/front/", fileName);
            //ocommon.CreateThumbnail1(FarmerMainPath, categoryImageFrontWidth, categoryImageFrontHeight, FarmerFrontPath, fileName);
            imgfarmer.Visible      = true;
            imgfarmer.ImageUrl     = FarmerFrontPath + fileName;
            ViewState["fileName"]  = fileName;
            btnRemove.Visible      = true;
            btnImageUpload.Visible = false;
        }
    }
 protected void btnImageUpload_Click(object sender, EventArgs e)
 {
     if (fpProduct.HasFile)
     {
         decimal size = Math.Round(((decimal)fpProduct.PostedFile.ContentLength / (decimal)1024), 2);
         if (size <= 2000)
         {
             string fileName = Path.GetFileNameWithoutExtension(fpProduct.FileName.Replace(' ', '_')) + DateTime.Now.Ticks.ToString() + Path.GetExtension(fpProduct.FileName);
             fpProduct.SaveAs(MapPath(productMainPath + fileName));
             ocommon.CreateThumbnail1("uploads\\product\\", productImageFrontWidth, productImageFrontHeight, "~/Uploads/product/water/", fileName);
             WatermarkImageCreate(fileName);
             imgProduct.Visible     = true;
             imgProduct.ImageUrl    = productWaterFrontPath + fileName;
             ViewState["fileName"]  = fileName;
             btnRemove.Visible      = true;
             btnImageUpload.Visible = false;
         }
         else
         {
             Response.Write("<script>alert('Image size Must be less than 2MB')</script>");
         }
     }
 }