Scripting.FileSystemObject.CreateTextFile goes out to lunch

Discussion in 'ASP General' started by NeilS, Apr 28, 2005.

  1. NeilS

    NeilS Guest

    I'm developing under IIS V5.1 and testing on an ethernet with IIS hosted on
    WinXPPro.

    I am trying to implement file-upload using a polished version of the
    technique published in
    <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasdj01/html/asp0900.asp>

    IIS goes out to lunch when it gets to the CreateTextFile statement in the
    lines:
    objFSO = server.createObject("Scripting.FileSystemObject")
    SavePath = Server.MapPath(FilePath)
    Set SaveFile = objFSO.CreateTextFile(SavePath, True)
    SaveFile.Write(fileData)
    SaveFile.Close
    - it is (presumably) the CreateTextFile method, because I can comment out
    the Write statement and it still hangs.
    Stopping and restarting IIS doesn't work, it's reboot time.

    I already have a (working) script that exports an Access query to an XML
    file in the directory I want to upload the file to, so it's (apparently) not
    a permissions issue.

    Any ideas of what I'm missing, or a workaround?

    Thanks

    NeilS

    BTW - the mods I did to Steven Disbrow's code were basically to get a factor
    of four improvement in processing speed for the file I wanted to upload by
    changing:
    PostData = ""
    Dim biData
    biData = Request.BinaryRead(Request.TotalBytes)
    'Careful! It's binary! So, let's change it into something a bit more
    manageable.
    For nIndex = 1 to LenB(biData)
    PostData = PostData & Chr(AscB(MidB(biData,nIndex,1)))
    Next

    To the following:
    rawLength = Request.TotalBytes
    Dim biData, chrData
    chrData = Array()
    Redim chrData(rawLength)
    biData = Request.BinaryRead(rawLength)
    For nIndex = 1 to rawLength
    chrData(nIndex) = Chr(AscB(MidB(biData,nIndex,1)))
    Next
    PostData = Join(chrData,"")

    - you can imagine the performance of moving quarter-megabyte strings around
    in memory every time you need to concatenate an extra character!
     
    NeilS, Apr 28, 2005
    #1
    1. Advertising

  2. > IIS goes out to lunch when it gets to the CreateTextFile statement in the
    > lines:
    > objFSO = server.createObject("Scripting.FileSystemObject")
    > SavePath = Server.MapPath(FilePath)
    > Set SaveFile = objFSO.CreateTextFile(SavePath, True)
    > SaveFile.Write(fileData)
    > SaveFile.Close
    > - it is (presumably) the CreateTextFile method, because I can comment out
    > the Write statement and it still hangs.
    > Stopping and restarting IIS doesn't work, it's reboot time.


    Some Antivirus programs blocks this kind of operation. See the
    configuration section to disable Script blocking.

    André
     
    André Nobre, Apr 28, 2005
    #2
    1. Advertising

  3. NeilS

    NeilS Guest

    "André Nobre" wrote:

    > Some Antivirus programs blocks this kind of operation. See the
    > configuration section to disable Script blocking.


    I remember now, I've been bitten by this one before. Thanks so much.

    Neil
     
    NeilS, Apr 28, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmltIEhlYXZleQ==?=

    Debug Mode - Goes to lunch

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Aug 5, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    326
    Lucas Tam
    Aug 5, 2005
  2. Replies:
    1
    Views:
    2,753
  3. Mark
    Replies:
    0
    Views:
    133
  4. spradl

    FileSystemObject.CreateTextFile Problem

    spradl, Aug 12, 2003, in forum: ASP General
    Replies:
    9
    Views:
    199
    Ray at
    Aug 14, 2003
  5. Iain Bishop

    FileSystemObject CreateTextFile falling over

    Iain Bishop, Sep 4, 2006, in forum: ASP General
    Replies:
    1
    Views:
    217
    Mike Brind
    Sep 4, 2006
Loading...

Share This Page