Not sure if this is the spot to ask but I need some help with a script I
hijacked and put to my own use in an .ASP page
any ways I am using the FilesystemObjec ts to get a directory and file
listing and generating a web page of that listing, but I need to filter out
files with the SYSTEM tag, so it wont show files I dont want it to, Below is
my full code for the ASP page, I have Commented where I need to change the
listing structure, if anyone can help me filter these out I would be
greatfull!!!
--- Begin code ---
<%@LANGUAGE="VB SCRIPT"%>
<%
Option Explicit
On Error Resume Next
' this section is optional - it just denies anonymous access
If Request.ServerV ariables("LOGON _USER")="" Then
Response.Status = "401 Access Denied"
End If
' declare variables
Dim objFSO, objFolder
Dim objCollection, objItem
Dim strPhysicalPath , strTitle, strServerName
Dim strPath, strTemp
Dim strName, strFile, strExt, strAttr
Dim intSizeB, intSizeK, intAttr, dtmDate
' declare constants
Const vbReadOnly = 1
Const vbHidden = 2
Const vbSystem = 4
Const vbVolume = 8
Const vbDirectory = 16
Const vbArchive = 32
Const vbAlias = 64
Const vbCompressed = 128
' don't cache the page
Response.AddHea der "Pragma", "No-Cache"
Response.CacheC ontrol = "Private"
' get the current folder URL path
strTemp = Mid(Request.Ser verVariables("U RL"),2)
strPath = ""
Do While Instr(strTemp,"/")
strPath = strPath & Left(strTemp,In str(strTemp,"/"))
strTemp = Mid(strTemp,Ins tr(strTemp,"/")+1)
Loop
strPath = "/" & strPath
' build the page title
strServerName = UCase(Request.S erverVariables( "SERVER_NAM E"))
strTitle = "Contents of the " & strPath & " folder"
' create the file system objects
strPhysicalPath = Server.MapPath( strPath)
Set objFSO = Server.CreateOb ject("Scripting .FileSystemObje ct")
Set objFolder = objFSO.GetFolde r(strPhysicalPa th)
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
</head>
<body text="#C0C0C0" bgcolor="#00000 0">
<div align="center">
<table border="0" width="80%" id="table1">
<tr>
<td align="center"> Some web page Info here<p align="right">< b><font
size="4">And here</font></b></td>
</tr>
</table>
</div>
<p align="center">
<img border="0" src="Folder.jpg ">
</p>
<p align="center"> <a href="../">Back</a></p>
<html>
<body>
<div align="center"> <center>
<table width="100%" border="0" cellspacing="1" cellpadding="2" >
<%
''''''''''''''' ''''''''''''''' ''''''''''
' output the folder list
''''''''''''''' ''''''''''''''' ''''''''''
Set objCollection = objFolder.SubFo lders
For Each objItem in objCollection
strName = objItem.Name
strAttr = MakeAttr(objIte m.Attributes)
dtmDate = CDate(objItem.D ateLastModified )
%>
<% Next %>
<%
''''''''''''''' ''''''''''''''' ''''''''''
' output the file list
''''''''''''''' ''''''''''''''' ''''''''''
Set objCollection = objFolder.Files
For Each objItem in objCollection
strName = objItem.Name
strFile = Server.HTMLEnco de(Lcase(strNam e))
intSizeB = objItem.Size
intSizeK = Int((intSizeB/1024) + .5)
If intSizeK = 0 Then intSizeK = 1
strAttr = MakeAttr(objIte m.Attributes)
strName = Ucase(objItem.S hortName)
If Instr(strName," .") Then strExt =
Right(strName,L en(strName)-Instr(strName," .")) Else strExt = ""
dtmDate = CDate(objItem.D ateLastModified )
%>
' This is where I am listing the Files in my webpage, but it lists all
files, and I need to block the listing of system Files'
<tr>
<td align="left">A< %=strFile%></a></td>
<td align="right"</td>
<td align="right">
<p align="left"><% =intSizeK%>K</td>
</tr>
<% Next %>
</table>
</center></div>
</body>
</html> 1 1947
EQNish wrote:
Not sure if this is the spot to ask but I need some help with a
script I hijacked and put to my own use in an .ASP page
Answered in .scripting.vbsc ript
This was the most appropriate place to post this, but Alex is doing a
good job with it in .scripting
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: MG |
last post by:
I'm in need of a form method similar to the typcial "file upload", but
rather than submitting the entire file, I need just the filename.
I cannot find anything as part of FORM that would allow this, short of
simply providing a text box, but I like the convenience of the file
selection dialogs.
|
by: Janaka |
last post by:
I've seen and used some samples where you can set the onclick attrubute to a
Button control to get it to do some javascript a la :
btnUse.Attributes = "DoSomeJS()";
However when i try and get this to work on certain controls such as the
ListItem in a RadioButtonList it just doesn't do anything? Does this
attributes property only render for certain controls?
|
by: JH |
last post by:
I am scanning selected drives and computers and capture all files and their
attributes. I am using the scripting file system object. It takes a long
time to collect the attributes. Is there a better and faster way of
capturing file attributes of all files in a selected drive or computer.
CreateObject("Scripting.FileSystemObject")
Folder = fso.GetFolder(Fname)
For Each File In Folder.Files
|
by: Fred Lazy |
last post by:
Is is possible to retrieve the name of an .js file from within the .js file
itself:
For example, if the file is named "bla.js" and it is imported into an html
document:
<script type="text/javascript" src="bla.js"></script>
Is it then possible from within "bla.js" get the name of the .js file
similarly to the window.location property, but for the .js file itself and
not the window the .js file is contained in. In other words, does the
|
by: Marko Vuksanovic |
last post by:
I am trying to cause the uplaod button, id="Upload",when clicked, to exectue the onClick event for Button1, id="Button1".
<asp:FileUpload id="FileUpload" runat="server"> </asp:FileUpload>
<asp:Button id="Upload" Text="Upload file" runat="server"> </asp:Button>
<asp:Button id="Button1" OnClick="UploadButton_Click" runat="server" Visible="false">
in the code behind file I am using the following code to add the __doPostBack to the...
| |
by: acoder |
last post by:
How to Upload a File in Coldfusion
Use the cffile tag for uploading files to the server.
Note that allowing people to upload files is fraught with danger and only trusted users should be allowed to upload files. Checks should be made to make sure that only allowed file types are uploaded.
The Client-Side
First of all, let us deal with the client side. This assumes some knowledge of HTML.
|
by: roswara |
last post by:
Dear all,
Currently, I am working on a project to make a web-based application using ASP 2.0 and C#. This application will ask user to input for an excel file which has graphs in it. Then the application will grab the graph as image file, and this image will be displayed as thumbnail in the page.
Is it possible to accomplish this feature?
If it is possible, would you please tell me how?
And if it is not possible, why?
|
by: Alvin SIU |
last post by:
Hi all,
I have 6 tables inside a MS Access 2003 mdb file.
I want to convert them as DB2 version -8 tables in AIX 5.2.
I have exported them as 6 XML files.
The XML files look fine.
Each record is embeded by a tag which is the table name.
|
by: patf |
last post by:
Hi - experienced programmer but this is my first Python program.
This URL will retrieve an excel spreadsheet containing (that day's)
msci stock index returns.
http://www.mscibarra.com/webapp/indexperf/excel?priceLevel=0&scope=0¤cy=15&style=C&size=36&market=1897&asOf=Jul+25%2C+2008&export=Excel_IEIPerfRegional
Want to write python to download and save the file.
So far I've arrived at this:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |