资源简介
bootstrap 文件上传
long lStartPos = 0;
int startPosition = 0;
int endPosition = 0;
var contentRange = System.Web.HttpContext.Current.Request.Headers["Content-Range"];
//bytes
if (!string.IsNullOrEmpty(contentRange))
{
contentRange = contentRange.Replace("bytes", "").Trim();
contentRange = contentRange.Substring(0, contentRange.IndexOf("/"));
string[] ranges = contentRange.Split('-');
startPosition = int.Parse(ranges[0]);
endPosition = int.Parse(ranges[1]);
}
System.IO.FileStream fs;
if (System.IO.File.Exists(saveFilePath))
{
fs = System.IO.File.OpenWrite(saveFilePath);
lStartPos = fs.Length;
}
else
{
fs = new System.IO.FileStream(saveFilePath, System.IO.FileMode.Create);
lStartPos = 0;
}
if (lStartPos > endPosition)
{
fs.Close();
return false;
}
else if (lStartPos < startPosition)
{
lStartPos = startPosition;
}
else if (lStartPos > startPosition && lStartPos < endPosition)
{
lStartPos = startPosition;
}
fs.Seek(lStartPos, System.IO.SeekOrigin.Current);
byte[] nbytes = new byte[512];
int nReadSize = 0;
nReadSize = file.InputStream.Read(nbytes, 0, 512);
try
{
while (nReadSize > 0)
{
fs.Write(nbytes, 0, nReadSize);
nReadSize = file.InputStream.Read(nbytes, 0, 512);
}
fs.Close();
return true;
}
catch (Exception ex)
{
fs.Close();
return false;
}
long lStartPos = 0;
int startPosition = 0;
int endPosition = 0;
var contentRange = System.Web.HttpContext.Current.Request.Headers["Content-Range"];
//bytes
if (!string.IsNullOrEmpty(contentRange))
{
contentRange = contentRange.Replace("bytes", "").Trim();
contentRange = contentRange.Substring(0, contentRange.IndexOf("/"));
string[] ranges = contentRange.Split('-');
startPosition = int.Parse(ranges[0]);
endPosition = int.Parse(ranges[1]);
}
System.IO.FileStream fs;
if (System.IO.File.Exists(saveFilePath))
{
fs = System.IO.File.OpenWrite(saveFilePath);
lStartPos = fs.Length;
}
else
{
fs = new System.IO.FileStream(saveFilePath, System.IO.FileMode.Create);
lStartPos = 0;
}
if (lStartPos > endPosition)
{
fs.Close();
return false;
}
else if (lStartPos < startPosition)
{
lStartPos = startPosition;
}
else if (lStartPos > startPosition && lStartPos < endPosition)
{
lStartPos = startPosition;
}
fs.Seek(lStartPos, System.IO.SeekOrigin.Current);
byte[] nbytes = new byte[512];
int nReadSize = 0;
nReadSize = file.InputStream.Read(nbytes, 0, 512);
try
{
while (nReadSize > 0)
{
fs.Write(nbytes, 0, nReadSize);
nReadSize = file.InputStream.Read(nbytes, 0, 512);
}
fs.Close();
return true;
}
catch (Exception ex)
{
fs.Close();
return false;
}
代码片段和文件信息
//------------------------------------------------------------------------------
//
// 此代码是根据模板生成的。
//
// 手动更改此文件可能会导致应用程序中发生异常行为。
// 如果重新生成代码,则将覆盖对此文件的手动更改。
//
//------------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Data.EntityClient;
using System.Data.objects;
using System.Data.objects.DataClasses;
using System.Linq;
using System.Runtime.Serialization;
using System.xml.Serialization;
using System.ComponentModel.DataAnnotations;
[assembly: EdmSchemaAttribute()]
namespace FileUploadDemo
{
#region 上下文
///
/// 没有元数据文档可用。
///
public partial class MyBlogEntities : objectContext
{
#re
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 280 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\App_Start\FilterConfig.cs
文件 605 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\App_Start\RouteConfig.cs
文件 483 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\App_Start\WebApiConfig.cs
文件 19456 2015-10-09 09:13 FileUploadDemo\FileUploadDemo\bin\FileUploadDemo.dll
文件 44544 2015-10-09 09:13 FileUploadDemo\FileUploadDemo\bin\FileUploadDemo.pdb
文件 45416 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\Microsoft.Web.Infrastructure.dll
文件 374784 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\Newtonsoft.Json.dll
文件 418776 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\Newtonsoft.Json.xm
文件 180832 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Net.Http.dll
文件 16480 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Net.Http.WebRequest.dll
文件 5439 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Net.Http.WebRequest.xm
文件 201824 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Net.Http.xm
文件 138328 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.Helpers.dll
文件 74208 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.Helpers.xm
文件 506976 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.Mvc.dll
文件 847872 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.Mvc.xm
文件 264792 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.Razor.dll
文件 365160 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.Razor.xm
文件 41048 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.WebPages.Deployment.dll
文件 2812 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.WebPages.Deployment.xm
文件 204376 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.WebPages.dll
文件 39512 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.WebPages.Razor.dll
文件 17776 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.WebPages.Razor.xm
文件 223301 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\System.Web.WebPages.xm
文件 17504 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\zh-Hans\System.Net.Http.resources.dll
文件 10336 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\zh-Hans\System.Net.Http.WebRequest.resources.dll
文件 15472 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\zh-Hans\System.Web.Helpers.resources.dll
文件 28768 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\zh-Hans\System.Web.Mvc.resources.dll
文件 24688 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\zh-Hans\System.Web.Razor.resources.dll
文件 12912 2015-08-21 13:05 FileUploadDemo\FileUploadDemo\bin\zh-Hans\System.Web.WebPages.Deployment.resources.dll
............此处省略413个文件信息
- 上一篇:FTP工具源码
- 下一篇:文件对比,比较,逐字节有界面
相关资源
- gmap离线地图执行文件
- Asp.net C#生成pdf文件
- C# 将office,PDF文件转换为SWF文件
- C#学生选课系统包括源程序及数据库文
- C# ftp多线程断点上传
- WinForm窗体程序中使用CefSharp获取加载
-
C#将数据库数据生成xm
l文件 - 大文件上传 带进度条 asp.net
- VS中NuGet包离线安装CefSharp.WinForms.49.
- C#.kgtemp转换.mp3文件源码请勿商用
- python 天气CSV文件
- WebZip乱码目录文件名修改
- 原创仿OpenFileDialog文件选择对话框源码
- C# 图像处理、神经网络、遗传算法集
- asp.net 文件上传demo
- C# winform TreeView树形菜单控件DEMO附配套
- 学生信息管理系统VS2010版文件
- C#俄罗斯方块源文件和资源文件
- 螺旋天线的CST仿真
- semantic ui 最全的css icon文件
- C# SOCKET加密文件消息传输通信
- c# vtk 读取dicom文件!
- C#读取excel、csv文件到折线图
- 大学内部软件系统 v1.0.rar
- 处理后的禁飞区 csv文件
- 基于C#的FTP上传Demo
- C#局域网内文件传输
- C# 文件加密器 源码
- 内容查找,根据指定的文件夹查找包
- C#操作INI配置文件
评论
共有 条评论