Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

help me! I can't create a Scripting.FileSystemObject... why?

1,137 views
Skip to first unread message

Rafael

unread,
Apr 18, 2002, 2:37:59 PM4/18/02
to
Hello,

I am a new subscriber, and I need to understand why I can't create a
Scripting.FileSystemObject...

I am experiencing the following errors:

Error type:
aspSmartUpload.File (0x80040460)
Unable to save file (Error 1120)
/scripts/aspSmartUpload/Sample1.asp, line 25

Browser:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Script:
POST 20438 bytes to /scripts/aspSmartUpload/Sample1.asp
POST Data:
error '80020009'

Exception.
/iisHelp/common/500-100.asp, line 223


Curt_C

unread,
Apr 18, 2002, 2:56:24 PM4/18/02
to
show the snippit you used for FSO
Line 125 and such....

--
Curt
Software_AT_Darkfalz.Com
http://www.Darkfalz.com
---------------------------------------------------------------
** And The Geek Shall Inherit The Earth
---------------------------------------------------------------
"Rafael" <raf...@analogkid.cjb.net> wrote in message
news:eedRBiw5BHA.2312@tkmsftngp05...

Rafael

unread,
Apr 18, 2002, 3:09:45 PM4/18/02
to
Do you want to say the piece of code?

here it is:
*************************
savename = "/images/file.txt";
filecontent = "Texto";
var fso = new ActiveXObject ("Scripting.FileSystemObject");
file = fso.CreateTextFile (Server.MapPath(save_name), true); //
overwrite
file.Write(filecontent);
file.Close ();
delete file; // delete object (not disk file);
delete fso;
********************

and the folder 'images' has writing permisssions.

Thanks for trying to help me

Rafael - Brazil

"Curt_C" <Software_AT_Darkfalz.Com> escreveu na mensagem
news:eBLPUpw5BHA.1632@tkmsftngp07...

Charles E Finkenbiner

unread,
Apr 18, 2002, 3:29:20 PM4/18/02
to
Hi Rafael,

Just a shot in the dark, but savename = "/images/file.txt"; is not the same
as file = fso.CreateTextFile (Server.MapPath(save_name), true);. savename
is not the same as save_name. Could that be the problem?

Hope this helps,

CEF

"Rafael" <raf...@analogkid.cjb.net> wrote in message

news:#of2zzw5BHA.1996@tkmsftngp05...

Tim Slattery

unread,
Apr 18, 2002, 4:05:00 PM4/18/02
to
"Rafael" <raf...@analogkid.cjb.net> wrote:

>Do you want to say the piece of code?
>
>here it is:
>*************************
> savename = "/images/file.txt";
> filecontent = "Texto";
> var fso = new ActiveXObject ("Scripting.FileSystemObject");

You can't initialize a VBS variable in the declaration. Also, you need
to use "set" to assign an object. And, you need to use
Server.CreateObject:

var fso
set fso = Server.CreateObject("Scripting.FileSystemObject")

And if you're on the client, you probably will be prevented from using
the file system object by security constraints.

--
Tim Slattery
MS MVP(DTS)
Slatt...@bls.gov

Rafael

unread,
Apr 18, 2002, 4:12:44 PM4/18/02
to
Tim,

I am not using VBScript on the script, I am using JScript, but I don't know
if this syntax below is acceptabel in JScript:

Server.CreateObject("Scripting.FileSystemObject");

My script is running on the same machine of the destination 'file', and it
was working before, but suddenly, I started to get problems...

Thanks,

Rafael


"Tim Slattery" <Slatt...@bls.gov> escreveu na mensagem
news:dj9ubugejvch6mqbs...@4ax.com...

Rafael

unread,
Apr 18, 2002, 4:18:56 PM4/18/02
to
Hello, Charles

Unfortunately, this is not the problem. I just typed 'save_name' incorrectly
at first occurrence in my post, but the script does not have this bug.

Thanks

Rafael

"Charles E Finkenbiner" <Charl...@Yahoo.Com> escreveu na mensagem
news:#6Jv#7w5BHA.2240@tkmsftngp04...

Rafael

unread,
Apr 19, 2002, 10:25:10 AM4/19/02
to
Now I know when the code crashes...

*************************
<%@LANGUAGE="JAVASCRIPT"%>
<%
save_name = "C:\images\file.txt";
filecontent = "Texto";
It's not here-> var fso = new ActiveXObject
("Scripting.FileSystemObject");
but here -> file = fso.CreateTextFile(save_name, true);
file.Write(filecontent);
file.Close();
delete file;
delete fso;
%>
********************

However, that folder has writing permissions... The mystery continues, to
me...

Rafael


P.S.: The error message that appears: (text in Brazilian Portuguese)

HTTP 500.100 - Servidor interno Erro - erro do ASP
Internet Information Services

----------------------------------------------------------------------------
----

Informações técnicas (para a equipe de suporte)

a.. Tipo de erro:
Erro em tempo de execução do Microsoft JScript (0x800A0046)
Permissão negada
/pcs/upload/write.asp, line 4


b.. Tipo de navegador:


Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

c.. Página:
GET /pcs/upload/write.asp

d.. Hora:
sexta-feira, 19 de abril de 2002, 11:08:49


e.. Mais informações:
Suporte da Microsoft

Charles E Finkenbiner

unread,
Apr 19, 2002, 3:45:25 PM4/19/02
to
Hi Rafael,

I see no 'var' in front of "file = fso.CreateTextFile(save_name, true);".
Have you defined it somewhere else?


Hope this helps,

CEF

"Rafael" <raf...@analogkid.cjb.net> wrote in message

news:evmcw565BHA.2088@tkmsftngp04...

Igor O

unread,
Apr 22, 2002, 4:51:28 AM4/22/02
to
What does MVP(DTS) stand for?

"Tim Slattery" <Slatt...@bls.gov> wrote in message
news:dj9ubugejvch6mqbs...@4ax.com...

Richard Roe

unread,
Apr 22, 2002, 8:42:20 AM4/22/02
to
Check your virtual directory permissions on IIS. Your require Scripts and
Executables permission to be set on Execute permissions.


"Rafael" <raf...@analogkid.cjb.net> wrote in message
news:evmcw565BHA.2088@tkmsftngp04...

Rafael

unread,
Apr 22, 2002, 10:09:28 AM4/22/02
to
Richard,

I did it, the folder has these permissions, and I also create an
"application" on IIS to debug it, but the problem persists...

Unfortunately the debug message does not contains additional information
beyond below... (Permission denied, etc.)

I am almost quitting...

Thanks,

Rafael

"Richard Roe" <ro...@nib.co.za> escreveu na mensagem
news:eFRYhsf6BHA.1632@tkmsftngp07...


| Check your virtual directory permissions on IIS. Your require Scripts and
| Executables permission to be set on Execute permissions.
|
|
| "Rafael" <raf...@analogkid.cjb.net> wrote in message
| news:evmcw565BHA.2088@tkmsftngp04...
| > Now I know when the code crashes...
| >
| > *************************
| > <%@LANGUAGE="JAVASCRIPT"%>
| > <%
| > save_name = "C:\images\file.txt";
| > filecontent = "Texto";
| > It's not here-> var fso = new

ActiveXObject("Scripting.FileSystemObject");

Rafael

unread,
Apr 22, 2002, 10:35:57 AM4/22/02
to
My friends, I am really, really sorry. I think I discovered the problem...

In JavaScript, to represent the backslash character is needed to put two
backslashes (i.e.: "\\" outputs "\")...

The single backslash is used to print out special characters. For example:

the linefeed is "\n";
the carriage-return is "\r";
the double-quote is "\"";

So, the wrong code:

********************
<%@LANGUAGE="JAVASCRIPT"%>
<%
It's HERE -> save_name = "C:\images\file.txt";


filecontent = "Texto";
It's not here-> var fso = new ActiveXObject("Scripting.FileSystemObject");

nor here -> file = fso.CreateTextFile(save_name, true);


file.Write(filecontent);
file.Close();
delete file;
delete fso;
%>
*******************

The correct code:

********************
<%@LANGUAGE="JAVASCRIPT"%>
<%
save_name = "C:\\images\\file.txt";
filecontent = "Texto";

var fso = new
ActiveXObject("Scripting.FileSystemObject");

file = fso.CreateTextFile(save_name, true);
file.Write(filecontent);
file.Close();
delete file;
delete fso;
%>
********************

Thanks for all who tried to help me

Rafael, from Brazil

P.S.: Forgive my poor English.


Bill James

unread,
Apr 22, 2002, 11:23:25 AM4/22/02
to
MVP = Most Valuable Professional. Read more here: http://support.microsoft.com/default.aspx?scid=%2Fsupport%2Fmvp%2Fdefault%2Easp.

--

Bill James
Microsoft MVP·DTS

Win9x VBScript Utilities » www.billsway.com/vbspage/
Windows Tweaks & Tips » www.billsway.com/notes_public/

"Igor O" <bed...@hotmail.com> wrote in message news:eog48qd6BHA.2140@tkmsftngp03...

Igor O

unread,
Apr 23, 2002, 3:26:02 AM4/23/02
to
Thanks Bill, I just needed to know exact title of a person who can produce
such a "masterpiece":

> > > savename = "/images/file.txt";
> > > filecontent = "Texto";
> > > var fso = new ActiveXObject ("Scripting.FileSystemObject");
> >
> > You can't initialize a VBS variable in the declaration. Also, you need
> > to use "set" to assign an object. And, you need to use
> > Server.CreateObject:
> >
> > var fso
> > set fso = Server.CreateObject("Scripting.FileSystemObject")


"Bill James" <wgj...@mvps.org> wrote in message
news:uFU2fIh6BHA.2308@tkmsftngp04...

0 new messages