91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-26
  • 語言: 其他
  • 標(biāo)簽: webuploader??

資源簡介

webuploader完整例子,百度切割上傳,包括前端頁面與后臺實例代碼。

資源截圖

代碼片段和文件信息

using?QianYuIntl.framework.Common.FileIO;
using?System;
using?System.Collections.Generic;
using?System.IO;
using?System.Linq;
using?System.Web;

namespace?QianYuIntl.Hr.Back.Web
{
????///?
????///?UploadFile?的摘要說明
????///?

????public?class?UploadFile?:?IHttpHandler
????{

????????///?
????????///?Action參數(shù)
????????///?

????????public?string?Action
????????{
????????????get?{return?HttpContext.Current.Request[“action“];?}
???????????
????????}

????????public?void?ProcessRequest(HttpContext?context)
????????{
????????????context.Response.ContentType?=?“text/plain“;
????????????object?strReturn?=?string.Empty;
????????????switch?(Action)
????????????{
????????????????case?“upload“:
????????????????????upload();
????????????????????break;
????????????????case?“MergeFile“:
????????????????????MergeFile();
????????????????????break;

????????????}
????????????context.Response.Write(“aaa“);
????????}


????????public?void?upload()
????????{
????????????HttpPostedFile?files?=?null;
????????????string?fileFromName?=?HttpContext.Current.Request[“fileFromName“];
????????????string?fileName?=?HttpContext.Current.Request[“name“];//文件名稱
????????????string?guid?=?HttpContext.Current.Request[“guid“];//前端傳來的GUID號
????????????int?index?=Convert.ToInt32(?HttpContext.Current.Request[“chunk“]);//當(dāng)前分塊序號????
????????????if?(!string.IsNullOrEmpty(fileFromName))
????????????{
????????????????files?=?HttpContext.Current.Request.Files[fileFromName];
????????????}
????????????else
????????????{
????????????????files?=?HttpContext.Current.Request.Files[0];
????????????}
????????????int?intlenght?=?files.ContentLength;
????????????byte[]?arrBt?=?new?byte[intlenght];?//圖片保存為二進制字節(jié)

????????????System.IO.Stream?strm?=?files.InputStream;
????????????strm.Read(arrBt?0?intlenght);
????????????string?strFile?=?String.Empty;
????????????System.IO.MemoryStream?m?=?null;
????????????System.IO.FileStream?fl?=?null;
????????????try
????????????{
????????????????#region?保存文件

????????????????/**/
????????????????///定義并實例化一個內(nèi)存流,以存放提交上來的字節(jié)數(shù)組。
????????????????m?=?new?System.IO.MemoryStream(arrBt);

????????????????string?newFilePath?=?“/Files“?+
????????????????????“/“?+?DateTime.Now.ToString(“yyyyMM/dd/“).Replace(“-“?“/“);

????????????????string?dir?=?“C:\\“?+?newFilePath.Replace(“/“?“\\“).Replace(“-“?“\\“);
????????????????string?newFileName=guid;

????????????????dir?=?dir?+?newFileName;

????????????????if?(dir.Length?==?0)?return;
????????????????if?(!Directory.Exists(?dir))
????????????????????Directory.CreateDirectory(?dir);

????????????????strFile?=?dir?+?“/“?+?index;
????????????????/**/
????????????????///定義實際文件對象,保存上載的文件。
????????????????fl?=?new?System.IO.FileStream(strFile?FileMode.OpenOrCreate);
????????????????/**/
????????????????///把內(nèi)內(nèi)存里的數(shù)據(jù)寫入物理文件
????????????????m.WriteTo(fl);
????????????????#endregion

????????????}
????????????catch?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????4099??2018-08-07?15:32??nopower.cshtml
?????文件????????5948??2018-08-07?15:32??UploadFile.ashx.cs

評論

共有 條評論