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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upload component giving trouble in JScript.

Status
Not open for further replies.

martindavey

Programmer
Jan 2, 2000
122
GB
Hi,
We've re-written all our pages in JScript but are having problems with the following code.

This small example works fine in VBScript:-
<%
Dim MBRequest
Set MBRequest = GetObject( &quot;script:&quot; & Server.MapPath( &quot;./admin/wsc/MetaBuilders.FileUp.wsc&quot; ) )
reqVar = MBRequest(&quot;myVar&quot;)
%>
<h1>Hello: <%=reqVar%></h1>
<form>
<input type=&quot;text&quot; name=&quot;myVar&quot; /><br />
<input type=&quot;submit&quot; />
</form>

But the following JScript fails with:
Object doesn't support named arguments
for the line: reqVar = MBRequest(&quot;myVar&quot;);

<%
var MBRequest = GetObject( &quot;script:&quot; + Server.MapPath( &quot;./admin/wsc/MetaBuilders.FileUp.wsc&quot; ) );
reqVar = MBRequest(&quot;myVar&quot;);
%>
<h1>Hello: <%=reqVar%></h1>
<form>
<input type=&quot;text&quot; name=&quot;myVar&quot; /><br />
<input type=&quot;submit&quot; />
</form>

Any ideas why?

NB. We're using Fileup.wsc to upload pictures.
 
Well GetObject() is not a JScript function; in fact there aren't any JScript functions other than the ones you define.

In ASP you might use Server.CreateObject() instead. The argument to this method is the name of the component you want to use as it is known to the operating system I think. This entails registering the component. For example

Code:
var fso = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;);

I don't know how you might register Fileup.wsc or what it might be named.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top