protected async void Page_Load(object sender, EventArgs e) { _arquivoRepository = ArquivoRepositoryFactory.Create(); Response.Clear(); long idDiretorio = Convert.ToInt64(Request.Params["parentFolderId"]); string token = Request.Params["token"]; string fileName = Request.Params["fileName"]; string mimeType = Request.Params["mimeType"]; Arquivo arquivoReferencia = await ArquivoRules.AddAsync(fileName, false, idDiretorio); IFileManager fileManager = FileManagerFactory.Create(); long fileSize = await fileManager.MergeChunksAsync(arquivoReferencia.Url, token); arquivoReferencia.Tamanho = fileSize; arquivoReferencia.MimeType = mimeType; await _arquivoRepository.UpdateAsync(arquivoReferencia); Response.Write(fileSize); Response.End(); }
protected async void Page_Load(object sender, EventArgs e) { _arquivoRepository = ArquivoRepositoryFactory.Create(); if (!IsPostBack) { Response.Clear(); long result = await HandleFileUploadAsync(); Response.Write(result); Response.End(); } }
protected async void Page_Load(object sender, EventArgs e) { long?idParent = !String.IsNullOrWhiteSpace(Request.Params["fkParent"]) ? Convert.ToInt64(Request.Params["fkParent"]) : (long?)null; IArquivoRepository arquivoRepository = ArquivoRepositoryFactory.Create(); IEnumerable <Arquivo> arquivos = await arquivoRepository.FindWhereParentEqualsAsync(idParent); Response.Clear(); Response.Write(new JavaScriptSerializer().Serialize(new { result = arquivos })); Response.End(); }
protected async void Page_Load(object sender, EventArgs e) { _arquivoRepository = ArquivoRepositoryFactory.Create(); if (!IsPostBack) { Response.Clear(); Arquivo arquivo = await PegarArquivoRequestAsync(); IFileManager fileManager = FileManagerFactory.Create(); using (Stream fileStream = await fileManager.GetStream(arquivo)) { Response.BufferOutput = false; Response.AddHeader("Content-Disposition", "attachment; filename=" + arquivo.Nome); Response.AddHeader("Content-Length", fileStream.Length.ToString()); Response.ContentType = String.IsNullOrWhiteSpace(arquivo.MimeType) ? "application/octet-stream" : arquivo.MimeType; fileStream.CopyTo(Response.OutputStream); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { _arquivoRepository = ArquivoRepositoryFactory.Create(); LimparMensagemErro(); }