public void DownloadFile(string id) { string FilePath = driveService.DownloadGoogleFile(id); Response.ContentType = "application/zip"; Response.WriteAsync(_hostingEnvironment.ContentRootPath); }
public void DownloadFile(string id) { string FilePath = GoogleDriveFilesRepository.DownloadGoogleFile(id); Response.ContentType = "application/zip"; Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(FilePath)); Response.WriteFile(System.Web.HttpContext.Current.Server.MapPath("~/GoogleDriveFiles/" + Path.GetFileName(FilePath))); Response.End(); Response.Flush(); }
public void DownloadFile(string id) { string FilePath = GoogleDriveFilesRepository.DownloadGoogleFile(id); Response.ContentType = "application/zip"; Response.Headers.Add("content-disposition", "attachment; filename=" + Path.GetFileName(FilePath)); string path = Path.Combine(_env.ContentRootPath, "~/GoogleDriveFiles/", Path.GetFileName(FilePath)); byte[] data = Encoding.ASCII.GetBytes(path); Response.Body.Write(data, 0, data.Length); //Response.StatusCode = StatusCodes.Status200OK; Response.Body.FlushAsync(); }
//Control gắn Watermark vào và download về máy public void DownloadFile(string id) { string FilePath = GoogleDriveFilesRepository.DownloadGoogleFile(id); file = new WaveSteg(new FileStream(FilePath, FileMode.Open, FileAccess.Read)); sh = new StagnoHelper(file); message = "Bản quyền thuộc về công ty TNHH KhueChin, bạn đã tải về lúc: " + DateTime.Now.ToString("HH:mm:ss dd-MM-yyyy zzz"); sh.HideMessage(message); file.WriteFile(FilePath); Response.ContentType = "application/zip"; Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(FilePath)); Response.WriteFile(System.Web.HttpContext.Current.Server.MapPath("~/GoogleDriveFiles/" + Path.GetFileName(FilePath))); Response.End(); Response.Flush(); }
public void DownloadFile(string id) { string FilePath = GoogleDriveFilesRepository.DownloadGoogleFile(id); file = new AudioFunction(new FileStream(FilePath, FileMode.Open, FileAccess.Read)); sh = new audoSteg(file); mess = "downloaded at " + DateTime.Now.ToString("HH:mm:ss dd-MM-yyyy zzzz"); sh.waterMess(mess); file.writeFile(FilePath); Response.ContentType = "application/zip"; Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(FilePath)); Response.WriteFile(System.Web.HttpContext.Current.Server.MapPath("~/GoogleDriveFiles/" + Path.GetFileName(FilePath))); Response.End(); Response.Flush(); System.IO.File.Delete(FilePath); }
public void DownloadFile(string id) { string FilePath = GoogleDriveFilesRepository.DownloadGoogleFile(id); file = new WaveSteg(new FileStream(FilePath, FileMode.Open, FileAccess.Read)); sh = new StagnoHelper(file); var sess = (UserLogin)Session[CommonConstants.User_Session]; message = sess.username; sh.HideMessage(message); file.WriteFile(FilePath); Response.ContentType = "application/zip"; Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(FilePath)); Response.WriteFile(System.Web.HttpContext.Current.Server.MapPath("~/GoogleDriveFiles/" + Path.GetFileName(FilePath))); Response.End(); Response.Flush(); }
//Download và watermark vào file wav public void DownloadFile(string id) { string FilePath = GoogleDriveFilesRepository.DownloadGoogleFile(id); //string FilePath1 = GoogleDriveFilesRepository.DownloadGoogleFile(id); file = new Functions(new FileStream(FilePath, FileMode.Open, FileAccess.Read)); sh = new audioSteg(file); message = "Copyright by Hoang Anh Minh, Download at: " + DateTime.Now.ToString("HH:mm:ss dd-MM-yyyy zzzz"); sh.waterMessage(message); file.writeFile(FilePath); //string FolderPath = System.Web.HttpContext.Current.Server.MapPath("/WavSteg/"); //FilesResource.GetRequest request = service.Files.Get(id); //string FileName = request.Execute().Name; //string FilePath1 = System.IO.Path.Combine(FolderPath, FileName); //Stream sourceStream = new FileStream(FilePath, FileMode.Open, FileAccess.Read); //FileStream destinationStream = new FileStream(FilePath1, FileMode.Create); //WaveStream audioStream = null; //audioStream = new WaveStream(sourceStream, destinationStream); //create a stream that contains the message, preceeded by its length //Stream messageStream = GetMessageStream(); //if(messageStream != null) //{ // messageStream.Close(); //} //if (audioStream != null) { audioStream.Close(); } //if (sourceStream != null) { sourceStream.Close(); } //Giau tin vao audio //WaveUtility utility = new WaveUtility(audioStream, destinationStream); //utility.Hide(messageStream); //if (destinationStream != null) { destinationStream.Close(); } Response.ContentType = "application /zip"; Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(FilePath)); Response.WriteFile(System.Web.HttpContext.Current.Server.MapPath("~/GoogleDriveFiles/" + Path.GetFileName(FilePath))); Response.End(); Response.Flush(); System.IO.File.Delete(FilePath); }