Beispiel #1
0
        protected void UploadControl_FilesUploadComplete(object sender, DevExpress.Web.FilesUploadCompleteEventArgs e)
        {
            try
            {
                foreach (UploadedFile file in UploadControl.UploadedFiles)
                {
                    //string dosyaAdiUret = DateTime.Now.ToString().Replace(".", "").Replace(":", "").Replace(" ", "");

                    string uploadFolder = Server.MapPath("~/App_Data/UploadDirectory/");

                    //string fileName = file.FileName;
                    //fileName = fileName.Replace(" ", "").Replace("-", "").Replace("İ","I").Replace("Ü","U").Replace("Ş","S").Replace("Ç","C").Replace("Ö","O").Replace("Ğ","G");
                    //fileName = dosyaAdiUret + fileName;
                    string resultExtension = Path.GetExtension(file.FileName);
                    string resultFileName  = Path.ChangeExtension(Path.GetRandomFileName(), resultExtension);
                    string fileName        = resultFileName;

                    file.SaveAs(uploadFolder + fileName);
                    e.CallbackData = fileName;

                    Guid UserGUID = new Guid(Membership.GetUser().ProviderUserKey.ToString());
                    var  sonuc    = db.I_AktivasyonAraRapor_Excel(uploadFolder + fileName, UserGUID).ToList().FirstOrDefault().Sonuc;
                }

                ////ASPxGridView1.DataSource = DataProvider.GetCagriIstekYenile();
                ////ASPxGridView1.DataSourceID = String.Empty;
                ////ASPxGridView1.DataBind();

                //DosyaYuklemePopup.JSProperties["cpVisible"] = "false";
                e.CallbackData = "success";
            }
            catch (Exception hata)
            {
                e.CallbackData = "error: " + hata.Message;
            }
        }