FSO Copy file:

Results 1 to 4 of 4

Thread: FSO Copy file:

  1. #1
    Ryder Guest

    Default FSO Copy file:

    I have the following code but when I try to run it I get the following error:<BR><BR>Microsoft VBScript runtime error &#039;800a01a8&#039; <BR><BR>Object required: &#039;index&#039; <BR><BR>/userpages.asp, line 19 <BR><BR><BR>Here is the Code:<BR><BR><BR>&#060;html&#062;<BR>&#060;body&#0 62;<BR>&#060;%if request.form("test")="" then%&#062;<BR>&#060;form method=post name=frm action="userpages.asp"&#062;<BR>&#060;input type=submit name=test value=Continue&#062;<BR>Username:&#060;input type="text" name="foldername" size="20"&#062;<BR>&#060;%else%&#062;<BR>&#060;%<B R>Dim fsoObject, reqFormFolder, filObject<BR><BR>reqFormFolder = Request.Form("foldername")<BR><BR>Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")< BR><BR>fsoObject.CreateFolder("C:wwwroot
    esadminmasterluemistonline.comwwwuserpages\" & reqFormFolder)<BR><BR>Set filObject = fsoObject.GetFile("C:wwwroot
    esadminmasterluemistonline.comwww empsindex.asp")<BR><BR>filObject.Copy ("C:wwwroot
    esadminmasterluemistonline.comwwwuserpages\" & reqFormFolderindex.asp)<BR><BR>response.write("Fol der Created")<BR>%&#062;<BR>&#060;%end if%&#062;<BR>&#060;/body&#062;<BR>&#060;/html&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default Yes? Why are you surprised?

    Look at this line:<BR><BR>filObject.Copy ("C:wwwroot
    esadminmasterluemistonline.comwwwuserpages\" & reqFormFolderindex.asp) <BR><BR>Let&#039;s simplify the string just a little, to make it fit on one line:<BR>&nbsp; &nbsp; filObject.Copy("C:acuserpages\" & reqFormFolderindex.asp) <BR><BR>Okay, now what are you asking VBScript to do, there?<BR><BR>You are asking it to concatenate a string ("C:...userpages\") with an expression, right?<BR><BR>And what is the expression?<BR>&nbsp; &nbsp; reqFormFolder index.asp <BR><BR>And how does VBS read that?<BR><BR>It looks for the variable named reqFormFolder. If you don&#039;t have one, it supplies a null variable.<BR><BR>It analyzes index.asp then. It sees what APPEARS to be an object (index) and a property on that object (asp) [the period between the two names says "property", just as in RS.EOF, et al.].<BR><BR>No problem. So index must be a variable that references some object. Right... Ummm...not right. index isn&#039;t defined. No problem. We&#039;ll define a variable named index for you. Presto. Oh, and we set it to null, just like we did reqFormFolder. And now we take the ".asp" property of that object...ummm...wait a minute...the object is null. Oh...<BR><BR>ERROR: Object Required.<BR><BR>And what, you might ask, was VBS going to do with that character? Easy. That&#039;s the "Integer Division" operator of VBScript. Honest. Go look it up in the VBS docs.<BR><BR>It was going to get the value of regFormFolder and do an integer divide of that (assumed!) number by the (assumed!) number it would have gotten from index.asp. If index hadn&#039;t proven to reference a null object.<BR><BR>Now, I could have said all this the short way and noted that apparently you forgot to put "..." around reqFormFolderindex.asp, but I will hope that, by explaining WHY you go the error you did, next time you&#039;ll be able to look at a VBS error message and analyze the problem immediately, instead of having to wait hours for an answer in this forum.<BR><BR>If I&#039;m really lucky, then several other people will have read this posting, too, and will also have an easier time in the future. <BR><BR>Good luck!<BR><BR>

  3. #3
    Ryder Guest

    Default RE: FSO Copy file:

    I cant seem to still get it to work, please help

  4. #4
    Join Date
    Dec 1969

    Default Well...

    Did you do what Bill said?<BR>filObject.Copy ("C:wwwroot
    esadminmasterluemistonline.comwwwuserpages\" & "reqFormFolderindex.asp") <BR>???<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts