Exemple #1
0
        protected void buttonSubmit_Click(object sender, EventArgs e)
        {
            UploadedFile file = UploadedFile.FromHttpPostedFile(Request.Files[inputFile.UniqueID]);

            if (!Object.Equals(file, null))
            {
                LooongMethodWhichUpdatesTheProgressContext(file);
                RadBinaryImage_fotoBig.Visible = true;

                Int32  tamaño      = Convert.ToInt32(file.InputStream.Length);
                byte[] byteArrayIn = new byte[tamaño + 1];

                file.InputStream.Read(byteArrayIn, 0, tamaño);
                RadBinaryImage_fotoBig.DataValue = byteArrayIn;
                Session["byteArrayIn"]           = byteArrayIn;
            }

            ModalPopup_Edit.Show();
        }
        protected void btnGrabar1_Click(object sender, EventArgs e)
        {
            try
            {
                string        sFile = string.Empty;
                StringBuilder sPath = new StringBuilder();
                sPath.Append(Server.MapPath("."));
                sPath.Append(@"\images\logos\");

                DBConn oConn = new DBConn();
                if (oConn.Open())
                {
                    foreach (string fileInputID in Request.Files)
                    {
                        UploadedFile file = UploadedFile.FromHttpPostedFile(Request.Files[fileInputID]);
                        if (file.ContentLength > 0)
                        {
                            sFile = file.GetName();
                            file.SaveAs(sPath.ToString() + file.GetName());
                        }
                    }
                    cAppLogoCliente oAppLogoCliente = new cAppLogoCliente(ref oConn);
                    oAppLogoCliente.NKey_cliente = CodCliente.Value;
                    oAppLogoCliente.LogoCliente  = sFile;
                    oAppLogoCliente.Tipo         = (string.IsNullOrEmpty(hddTipo.Value) ? "C" : hddTipo.Value);
                    oAppLogoCliente.Accion       = (string.IsNullOrEmpty(hddAccion.Value) ? "CREAR" : "EDITAR");
                    oAppLogoCliente.Put();

                    getImage(sFile);
                }
                oConn.Close();
            }
            catch (Exception Ex)
            {
                Response.Write("Error: " + Ex.Message);
            }
        }