Esempio n. 1
0
        protected void UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
        {
            try
            {
                Account account = new Account("dlyvxs7of", "634626974285569", "FtB_0jhcmFypFS7QTwCBKcPRGzE");

                Cloudinary        cloudinary   = new Cloudinary(account);
                ImageUploadParams uploadParams = new ImageUploadParams()
                {
                    File = new FileDescription("file", new MemoryStream(e.GetContents()))
                };

                ImageUploadResult uploadResult = cloudinary.Upload(uploadParams);

                HEWDataContext context = new HEWDataContext();
                context.ProjectsImages.InsertOnSubmit(new ProjectsImage
                {
                    ImgPublicID = uploadResult.PublicId, ProjectID = int.Parse(Request.QueryString["ProjectID"])
                });
                context.SubmitChanges();
            }
            catch (Exception)
            {
            }
        }
Esempio n. 2
0
        protected void saveImage(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
        {
            string tempPath = System.IO.Path.GetTempPath();

            System.Drawing.Image img = new GUIHelper().byteArrayToImage(e.GetContents());

            if (Session["fileContentType_"] == null)
            {
                Session.Add(("fileContentType_"), e.ContentType);
            }
            Session["fileContentType_"] = e.ContentType;

            if (Session["fileContents_"] == null)
            {
                Session.Add("fileContents_", e.GetContents());
            }
            Session["fileContents_"] = e.GetContents();

            string relativePath = Page.AppRelativeVirtualPath;

            relativePath = relativePath.Replace("~", "");
            e.PostedUrl  = String.Format("/HRM" + relativePath + "?preview=1");
        }
Esempio n. 3
0
        protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            if (e.State != AjaxControlToolkit.AjaxFileUploadState.Success)
            {
                lblFileRequired.Text = Resources.LogbookEntry.errImportInvalidCSVFile;
                SetWizardStep(wsUpload);
                return;
            }

            Session[szSessFile] = e.GetContents();

            e.DeleteTemporaryData();

            // Now we wait for the force refresh
        }
Esempio n. 4
0
        protected void fuResim_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
        {
            string dir = ConfigurationManager.AppSettings["NewsImagePath"] + @"\" + Helper.GetDirectory();
            string rnd = Helper.GetDirectoryForInline();

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            byte[]       imageByteArray = e.GetContents();
            MemoryStream stream         = new MemoryStream();

            stream.Write(imageByteArray, 0, imageByteArray.Length);
            Bitmap imageBitMap = new Bitmap(stream);

            System.Drawing.Image yeniImg    = System.Drawing.Image.FromStream(stream);
            int         height              = (yeniImg.Height * 640) / yeniImg.Width;
            UploadImage uploadHabericiResim = new UploadImage();

            uploadHabericiResim.SaveImageSingle(imageBitMap, dir, rnd + e.FileName, 640, height);
        }