web,uploader使用教程

时间:2021-10-29 03:25:14 初二作文

篇一:《ASP FSO操作文件(复制文件、重命名文件、删除文件、替换字符串)》

FSO的意思是FileSystemObject,即文件系统对象。FSO对象模型包含在

Scripting 类型库 (Scrrun.Dll)中,它同时包含了Drive、Folder、File、

FileSystemObject和TextStream五个对象,用来操作文件和文件夹十分方便。 (请注意后面的常用函数)

FSO文件(File)对象属性

DateCreated 返回该文件夹的创建日期和时间

DateLastAccessed 返回最后一次访问该文件的日期和时间

DateLastModified 返回最后一次修改该文件的日期和时间

Drive 返回该文件所在的驱动器的Drive对象

Name 设定或返回文件的名字

ParentFolder 返回该文件的父文件夹的Folder对象

Path 返回文件的绝对路径,可使用长文件名

ShortName 返回DOS风格的8.3形式的文件名

ShortPath 返回DOS风格的8.3形式的文件绝对路径

Size 返回该文件的大小(字节)

Type 如果可能,返回一个文件类型的说明字符串

FSO文件(File)对象方法

FSO文件对象方法 用途

CopyFile 拷贝一个或者多个文件到新路径

CreateTextFile 创建文件并且返回一个TextStream对象

DeleteFile 删除一个文件

OpenTextFile 打开文件并且返回TextStream对象,以便读取或者追加

重命名文件:

Function reName(sourceName,destName)

dim oFso,oFile

set oFso=server.createobject("Scripting.FileSystemObject")

set oFile=oFso.getFile(Server.mappath(sourceName))

oFile.Name=destName

Set oFso=Nothing

Set oFile=Nothing

End Function

删除文件:

Function FSOdel(fileName)

dim fso,f

set fso = server.CreateObject("scripting.filesystemobject")

f=server.MapPath(fileName)

if fso.FileExists(f) then

fso.DeleteFile f,true

end if

set f = nothing

set fso = nothing

End Function

替换文件中的字符串:

Function FSOreplace(fileName,Target,repString)

Dim objFSO,objCountFile,FiletempData

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Set objCountFile = objFSO.OpenTextFile(Server.MapPath(fileName),1,True) FiletempData = objCountFile.ReadAll

objCountFile.Close

FiletempData=Replace(FiletempData,Target,repString)

Set objCountFile=objFSO.CreateTextFile(Server.MapPath(fileName),True) objCountFile.Write FiletempData

objCountFile.Close

Set objCountFile=Nothing

Set objFSO = Nothing

End Function

<%

'*******************************************************

'函数名:CreateFolder(sPath)

'作 用: 创建目录

'参 数:sPath : 创建的相对目录路径

'返回值:成功 true , 失败 false

'*******************************************************

'response.Write createfolder("/dgsunshine/UploadFile/demo1/") Function CreateFolder(sPath)

On Error Resume Next

Dim Fso,Arrfolder,Folder,i,j

If sPath="" then

CreateFolder = False

Exit Function

End If

If Left(sPath,1) = "/" Then

Folder = "/"

sPath = Mid(sPath,2,Len(sPath))

Else

Folder = "./"

End If

if Right(sPath,1) = "/" then sPath = Left(sPath,Len(sPath)-1) ArrFolder = Split(sPath,"/")

Set Fso = Server.CreateObject("Scripting.FileSystemObject")

For i = 0 To Ubound(ArrFolder)

If i = 0 then

Folder = Folder & ArrFolder(i) & "/"

Else

Folder = Folder & ArrFolder(i) & "/"

End If

If Fso.folderExists(Server.MapPath(Folder)) = False then response.Write server.MapPath(folder)

Fso.createFolder(Server.MapPath(Folder))

End If

Next

Set Fso = nothing

If Err.Number <> 0 then

Err.clear()

CreateFolder = False

Else

CreateFolder = True

End If

End function

Function getFile(paramFilePath)

Set Fso = Server.CreateObject("Scripting.FileSystemObject") Set Fso_Read =

fso.OpenTextFile(Server.MapPath(paramFilePath),1,false,-2)

getFile = Fso_Read.readall

Set Fso_Read = Nothing

Set Fso = Nothing

End Function

'******************************************************* '函数名:CreateFile(paramFileContent,paramFilePath)

'作 用: 创建文件

'参 数:paramFileContent '文件的内容

' paramFilePath '文件名(不包括路径)

'返回值:成功 true , 失败 false

'******************************************************* Function CreateFile(paramFileContent,paramFilePath)

On Error Resume Next

Dim Fso,fWrite

Set Fso = Server.CreateObject("Scripting.FileSystemObject") Set fWrite =

Fso.CreateTextFile(Server.Mappath(paramFilePath),true)

fWrite.write paramFileContent

fWrite.close(){web,uploader使用教程}.

Set fWrite = nothing

Set Fso = nothing

If Err.number <> 0 Then

Err.clear()

CreateFile = False

Else

CreateFile = True

End If

End Function

'******************************************************* '函数名:DelFile(FilePath)

'作 用: 删除文件

'参 数:FilePath '文件路径 多个文件用"|"隔开

'返回值:成功 true , 失败 false

'******************************************************* Function DelFile(FilePath)

On Error Resume Next

Dim fso,arrFile,i

If GetSafeStr(FilePath,"")="" then

CreateFolder = false

Exit Function

End If

arrFile = Split(FilePath,"|")

Set Fso = Server.CreateObject("Scripting.FileSystemObject")

for i=0 to UBound(arrFile)

FilePath = arrFile(i)

If Fso.FileExists(Server.MapPath(FilePath)) then Fso.DeleteFile Server.MapPath(FilePath)

End If

Next

Set fso = nothing

篇二:《标签需求、设计说明书》

文件上传

标签用途和功能介绍

1.

2.

3.

4. 支持多个文件上传 对上传文件进行增加、删除、删除所有等操作 对上传文件前检测同名文件,以及上传文件的大小限制 包含中文名称的文件上传、附件上传成功后,在数据库表中插入一条记录,记录信

息包括一个随机字符的字段,在下载时候通过该字段找到相应的附件

5. 上传文件时候, 反映上传进度

界面设计说明

对上传操作的页面显示做了以下人性化操作:

1、可以任意在上传多个文件,只需在一个上传文件的输入框中完成

2、上传前在不访问数据库的前提下,进行增加、删除、删除所有等操作

3、在上传文件前检测同名文件,以及上传文件的大小

4、上传文件时候,可以在页面反映出:

1. 等待上传的文件列表

2. 正在上传文件的文件名,以及进度百分比和进度条

3. 已经上传文件的文件列表

操作说明

武汉贝斯特软件技术有限公司 Page 1 of 2

代码说明

类文件

com/bestsoft/ssh/comm//upload/UploadTag.java 封装了在jsp页面显示的html标签

com/bestsoft/ssh/web/action/upload/UploadFileAction.java 封装了上传文件的方法

jsp文件

WEB-INF/jsp/upload/percent-ajax.jsp 封装进度条的显示

WEB-INF/jsp/upload/upload-ajax.jsp 封装选择上传文件的操作

文件

js/upload/upload.js 封装上传文件的脚本程序

其他文件

WEB-INF/tld/upload包下所有文件.tld文件(设置标签属性)

武汉贝斯特软件技术有限公司 Page 2 of 2

篇三:《uploadify教程》

Uploadify使用说明

什么是Uploadify

原文:Uploadify is a jQuery plugin that integrates a fully-customizable multiple file upload utility on your website. It uses a mixture of Javascript, ActionScript, and any server-side language to dynamically create an instance over any DOM element on a page.

译文:Uploadify是一个jQuery插件,集成了一个完全可定制的多个文件上传您的网站上的效用。它混合使用的Javascript,ActionScript,和任何服务器端语言来动态创建的任何一个页面上的DOM元素的一个实例。

原文: Uploadify was born out of the need for a multiple file upload utility for a CMS that was

being developed. After evaluating the other available options, RonnieSan decided the best option was to build a new plug-in and make it available to the development community. In order to make the plug-in easy to implement and highly-customizable, the jQuery format was chosen. After word got out, the popularity of the plug-in spawned the need for a dedicated site. Travis Nickels volunteered his help to refine the Uploadify plug-in and make it what it is today.

译文:CMS开发后,需要实现多文件上传功能,这样,Uploadify这个实用工具诞生了。经过评过其他可用选项,RonnieSan决定创建一个新的插件提供给开发社区。为了使这个插件容易实施,并可高度定制,最后选择了Jquery.消息传出后,这个插件的普及,使其需要一个专门的网站来提供支持。Travis Nickels自告奋勇的去帮助和完善Uploadify插件。这就是我们今天看到的这个网站。

Uplodify的特点{web,uploader使用教程}.

怎么使用Uploadify

原文:Uploadify was created to be an easy-to-implement solution for multiple file uploads. As a jQuery plugin, the Uploadify implementation is simple and highly-customizable.

While it may require a foundational knowledge of jQuery to successfully implement, this documentation should provide a comprehensive enough reference for those who are having trouble. If you are running into issues that this documentation can't help solve, there is an active community of Uploadify users that can be accessed through the . In addition, we've provided a list of that may also aid in troubleshooting your Uploadify instance

译文:

Uploadify是一个简单易用的多文件上传方案。作为一个Jquery插件,Uploadify使用简单,并具有高度的定制性。

正常使用Uploadify插件需要一些Jquery基础知识。为了减少使用问题,本文档提供了足够全面的参考知识。如果该文档不能解决你在使用中遇到的问题,请访问论坛()获取更多信息。此外,我们提供了常见问题列表,也许这些信息也能帮助你解决Uploadify在使用中遇到的问题。

示例代码

头文件引入

<link href="uploadify/uploadify.css" type="text/css" rel="Stylesheet" rev="Stylesheet" /> <script type="text/javascript" language="javascript" src="uploadify/jquery-1.4.2.min.js"></script> <script type="text/javascript" language="javascript" src="uploadify/swfobject.js"></script> <script type="text/javascript" language="javascript" src="uploadify/jquery.uploadify.v2.1.4.min.js"></script>

使用Uploadify插件需要引入uploadify.css、jquery.js、swfobjects.js、和uploadify.js等4个文件

HTML文件

<input type="file" id="up_file" />

如果只是实现简单的文件上传功能,只需要在body里,添加一个file。 Js代码

<script type="text/javascript" language="javascript"> $(document).ready(function () { $("#up_file").uploadify({

'uploader': '/uploadify/uploadify/uploadify.swf', 'script': '/uploadify/UploadifyHandler.ashx', 'cancelImg': '/uploadify/uploadify/cancel.png', 'folder': '/upload', 'auto':true,

'multi':true }); }); </script>

事件

1、onAllComplete:当队列中所有文件上传完成后触发。 示例

„onAllComplete‟:function(event,data){….} event:事件对象(the event object) 示例{web,uploader使用教程}.

„onCancel‟:function(event,ID,fileObj,data){…} event:事件对象(the event object) ID:被取消的文件的唯一标识

2、onCancel:当队列中的每个文件别移除时触发

示例:function(event,data,key){。。。。} event:事件对象(the event object)

3、onCheck: 上传开始前,如果发现有同名的文件存在则触发该事件。

data:包含服务器段所有文件名称的一个列表。每个文件的关键字是队列中的唯一标识。 key:用户服务器段检测的唯一标识

4、onClearQueue: 当uploadifyClearQueue()方法调用时触发 示例:‟onClearQueue