473,387 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

FileSystemObject CreateTextFile falling over

I am trying to execute the following function which performs four tests to
make sure the current environment is capable of uploading files. Test 1
completes ok, but test 2 results in the page hanging indefinitely. An error
number is not returned (it just hangs on the line: Set testFile =
fso.CreateTextFile(fileName, true) ). However when I execute test 2 using
VBScript from within an Excel macro it creates the text file without any
problem.
I have given IUSR & IWAM Administrator rights but this has not helped.

Does anyone please have any ideas?

Many Thanks
Iain

function TestEnvironment()
Dim fso, fileName, testFile, streamTest
TestEnvironment = ""

'Test 1
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FolderExists(uploadsDirVar) then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not
exist.</B><br>The value of your uploadsDirVar is incorrect. Open
AdminFileUpload.asp in an editor and change the value of uploadsDirVar to
the pathname of a directory with write permissions."
exit function
end if

'Test 2
fileName = uploadsDirVar & "\test.txt"
on error resume next
Set testFile = fso.CreateTextFile(fileName, true)
If Err.Number<>0 then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have
write permissions.</B><br>The value of your uploadsDirVar is incorrect. Open
AdminFileUpload.asp in an editor and change the value of uploadsDirVar to
the pathname of a directory with write permissions."
exit function
end if
Err.Clear
testFile.Close

'Test 3
fso.DeleteFile(fileName)
If Err.Number<>0 then
TestEnvironment = "<B>Folder " & uploadsDirVar & " does not have
delete permissions</B>, although it does have write permissions.<br>Change
the permissions for IUSR_<I>computername</Ion this folder."
exit function
end if
Err.Clear

'Test 4
Set streamTest = Server.CreateObject("ADODB.Stream")
If Err.Number<>0 then
TestEnvironment = "<B>The ADODB object <I>Stream</Iis not
available in your server.</B><br>Check the Requirements page for information
about upgrading your ADODB libraries."
exit function
end if
Set streamTest = Nothing
end function
Sep 4 '06 #1
1 2467

Iain Bishop wrote:
I am trying to execute the following function which performs four tests to
make sure the current environment is capable of uploading files. Test 1
completes ok, but test 2 results in the page hanging indefinitely.
http://classicasp.aspfaq.com/files/d...-a-sudden.html

--
Mike Brind

Sep 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: spradl | last post by:
Hi, I am trying to create a dynamic CSV file via FileSystemObject.CreateTextFile. I have no problem creating the CSV file normally but I would like to insert comments and VBScript into the...
1
by: Scott MacLean | last post by:
I'm pulling my hair out over this one. I've got a web page that I need to have write to another server across the network. The site in question does NOT run in anonymous mode, that is, the user is...
8
by: jessie | last post by:
This my code for practice: <html> <body> <% Response.Write("6 ") dim fs,fname set fs=CreateObject("Scripting.FileSystemObject") set fname=fs.CreateTextFile("f:\test.txt")...
2
by: MeAndI | last post by:
I've some problems with "Scripting.FileSystemObject" object If I try to create a new text file with the function myfile.CreateTextFile I have two differents result: If I execute the script...
1
by: John | last post by:
Hi! I have written a sub routine which opens a file and write in it. The code I wrote is the following: Sub WriteToFile(afm,data) Dim filename,objFSO,objFile filename=afm Set...
4
by: Vilmar Brazão de Oliveira | last post by:
Hi, I got the err below, nevertheless my folders have full permissions for all. Permission denied /vilmar/ASP_JavaScript_CSS_HTML/ajudas_asp_completos/novo_asp/novo_asp_4-12-...
2
by: NeilS | last post by:
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...
2
by: Stavros | last post by:
Hi all when I execute the following VB6 code in Windows 2000 and as an Administrator, everything is working fine. Project->References->"Microsoft Scripting Runtime" and scrrun.dll is located...
1
by: novadoft | last post by:
hi, i am trying to use the fileSystemObject methods to read a picture file as a text (forcefully), store it in a variable, and then i try writing it back to a file and opening it up with a text...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.