File Properties

J

Jack Ramius

Ok.....

I'm trying to create a project where my company has to track certain
images on our company web site. What we need is the name, date
modified and size of the files in a presentable ASP app list format.

What I've done was create a database that stores the file location and
name. What I need is the asp vbscript code to find the size of the
file on the website server.

I've looked up some info such as the following...

Dim fso, f, FileName
Set fso = CreateObject("Scripting.FileSystemObject")
FileName="http://www.ourwebsite.com/Pic.gif"
Set f = fso.GetFile(FileName)
Response.Write(f.Size)

but I keep getting an error on this......can anyone help?

Jack
 
R

Ray at

It's generally a good idea to tell us what the error is instead of just
saying you get an error.

You can't get a file with an http path like that. You have to use the path
on the file system.
FileName = "C:\Path\On\Server\pic.gif"

Ray at work
 
J

Jack Ramius

If I can't get a file with an HTTP path using the
FileSystemObject.....is there a way I can use an HTTP path by using
some other method?
 
R

Ray at

May I ask why? Are you trying to retrive a file from another server?

Ray at work
 
D

Dan Brussee

Im going to guess No. If you use HTTP, you are going to get the result
that the server gives you. You need an OS level pointer to the file so
you can collect the information. Maybe if you described what exactly
you are doing it would help. Are you asking for a filename from a user
and getting info for him or what?
 
J

Jack Ramius

The reason I'm looking for a way to do this is the company I just
started working for sends out newsletters and has stored the images on
our website, which is maintained by a third party. (It is a very
small company). So my boss wants to know the size of these files
along with the names and other properties because the bigger the
files, the longer it takes to upload a newsletter.

If this means I will have to keep a copy on our local server then I
guess I will have to download all the files.

Jack Ramius
 
M

Mark Schupp

Try sending a HEAD request:

<%@ LANGUAGE="VBSCRIPT"%>
<%
option explicit

dim xmlhttp
dim targeturl
dim result
dim resultcode
dim resultmsg

targeturl = "http://localhost/kx/logo.gif"

set xmlhttp = server.CreateObject("MSXML2.ServerXMLHTTP")

xmlhttp.open "HEAD", targeturl, false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send ""

Response.Write xmlhttp.status & "<br>"
Response.Write xmlhttp.getResponseHeader("last-modified") & "<br>"
Response.Write xmlhttp.getResponseHeader("content-length") & "<br>"

result = xmlhttp.responseText

Response.Write result

Set xmlhttp = nothing
%>
 
J

Jack Ramius

Thanks...this seems to work

Mark Schupp said:
Try sending a HEAD request:

<%@ LANGUAGE="VBSCRIPT"%>
<%
option explicit

dim xmlhttp
dim targeturl
dim result
dim resultcode
dim resultmsg

targeturl = "http://localhost/kx/logo.gif"

set xmlhttp = server.CreateObject("MSXML2.ServerXMLHTTP")

xmlhttp.open "HEAD", targeturl, false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send ""

Response.Write xmlhttp.status & "<br>"
Response.Write xmlhttp.getResponseHeader("last-modified") & "<br>"
Response.Write xmlhttp.getResponseHeader("content-length") & "<br>"

result = xmlhttp.responseText

Response.Write result

Set xmlhttp = nothing
%>


--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top