Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP=>ASP 1

Status
Not open for further replies.

jammer1221

Programmer
Jul 30, 2003
352
US
Hey all,

I have this code and it is not functioning correctly. I am a PHP developer and know almost no ASP. Either way, I'm trying to write some varibles to a javascript function that will be called once the page loads. The two varibles are when the page first loads and the size of the current page.
Code:
<%
dim fs,f
function UDate(oldDate)
UDate = DateDiff("s", "01/01/1970 00:00:00", oldDate)
end function


set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("getSpeed2.asp")
if (f.Size) then

%>
<body onLoad="tt(<%UDate(Now())%>,<% Response.Write f.Size %>">
<%
end if
set f=nothing
set fs=nothing

%>

The code doesn't seem to be working. It says: /content/Inactive/Research_andamp_Development_-_MP/getSpeed2.asp, line 9
I would assume thats because it can't find getSpeed2.asp. Any help would be greatly appreciated.

Also, if there are any PHP & ASP developers out there here is my PHP code (simplified) that I was trying to convert to ASP...
Code:
<?php
$filesize = filesize("getSpeed2.php");

echo "<body onLoad=\"tt(".$_SERVER["REQUEST_TIME"].",".$filesize.")\">"

?>

Thanks,
Matt
 
you are missing = sign

<body onLoad="tt(<%=UDate(Now())%>,<% Response.Write f.Size %>">

-DNG
 
Yes, thank you!

But, I am still getting a error. This is what the page says...
Code:
Microsoft VBScript runtime  error '800a0035'

File not found

/content/Inactive/Research_andamp_Development_-_MP/getSpeed2.asp, line 9
 
This is what I changed my code to and it works perfectly...
Code:
set f=fs.GetFile(Server.MapPath("getSpeed2.asp"))

Thank you very much!

Matt
 
no problem...glad to assist...
post back if you have any questions...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top