可利用該語法來處理:new ActiveXObject("Scripting.FileSystemObject")


看到有些人不推這種方式,但是應用於內網,所以安全性設定可以統一佈署,這個問題倒是不難處理。

 

 


 

 

Check 上傳檔案大小 (內有說明優缺點及詳細範例,擷錄部份文章如下)

http://iammic.pixnet.net/blog/post/11866034-check-%E4%B8%8A%E5%82%B3%E6%AA%94%E6%A1%88%E5%A4%A7%E5%B0%8F

使用時會跳出下列警告視窗,不是很方便

2010-08-08_113502

 


 

 


JavaScript Essence: 安全限制

http://openhome.cc/Gossip/JavaScript/SecurityConstraint.html

 

js到底能不能判断客户端上传文件的大小

http://bbs.csdn.net/topics/280043968

function getFileSize(filepath) { //這段可正常運作!
   if(window.ActiveXObject){
       var fso=new ActiveXObject("Scripting.FileSystemObject");
       var file=fso.GetFile(filepath);
       filesize=file.size;
    }

 

Check file size with Javascript

http://bytes.com/topic/javascript/answers/460516-check-file-size-javascript 

 

上傳檔案前,JavaScript檢查檔案格式、大小(只針對圖片)

http://www.dotblogs.com.tw/topcat/archive/2009/02/20/7250.aspx 

 

 

Javascript的FileSystemObject功能

http://www.code-club.idv.tw/index.php?action=index&run=article_read&ClassID=37&ArticleID=1538

http://big5.sj33.cn/jc/wyjc/jsjc/200610/10075.html

http://www.coolsun.idv.tw/modules/xhnewbb/viewtopic.php?topic_id=1100

 

 


 

引用文章:http://www.w3schools.com/asp/asp_ref_filesystem.asp

>> 可以查一下FSO的相關參數使用。

 

The FileSystemObject Object

The FileSystemObject object is used to access the file system on a server.

This object can manipulate files, folders, and directory paths. It is also possible to retrieve file system information with this object.

The following code creates a text file (c:\test.txt) and then writes some text to the file:

<%
dim fs,fname
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fname=fs.CreateTextFile("c:\test.txt",true)
fname.WriteLine("Hello World!")
fname.Close
set fname=nothing
set fs=nothing
%>


The FileSystemObject object's properties and methods are described below:

Properties

PropertyDescription
Drives Returns a collection of all Drive objects on the computer

Methods

MethodDescription
BuildPath Appends a name to an existing path
CopyFile Copies one or more files from one location to another
CopyFolder Copies one or more folders from one location to another
CreateFolder Creates a new folder
CreateTextFile Creates a text file and returns a TextStream object that can be used to read from, or write to the file
DeleteFile Deletes one or more specified files
DeleteFolder Deletes one or more specified folders
DriveExists Checks if a specified drive exists
FileExists Checks if a specified file exists
FolderExists Checks if a specified folder exists
GetAbsolutePathName Returns the complete path from the root of the drive for the specified path
GetBaseName Returns the base name of a specified file or folder
GetDrive Returns a Drive object corresponding to the drive in a specified path
GetDriveName Returns the drive name of a specified path
GetExtensionName Returns the file extension name for the last component in a specified path
GetFile Returns a File object for a specified path
GetFileName Returns the file name or folder name for the last component in a specified path
GetFolder Returns a Folder object for a specified path
GetParentFolderName Returns the name of the parent folder of the last component in a specified path
GetSpecialFolder Returns the path to some of Windows' special folders
GetTempName Returns a randomly generated temporary file or folder
MoveFile Moves one or more files from one location to another
MoveFolder Moves one or more folders from one location to another
OpenTextFile Opens a file and returns a TextStream object that can be used to access the file
arrow
arrow
    全站熱搜

    Nathan 發表在 痞客邦 留言(0) 人氣()