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

ERROR on 'Set file = fso.opentextfile(path,3,TRUE)

Status
Not open for further replies.

PCLWebster

Technical User
Feb 2, 2001
3
GB
I'm just starting out with ASP and I am having loads of probs getting to write a file. I get an Error on the line containing Set file = fso.opentextfile(path,3,TRUE

I dunno why.. Maybe its because I havent been given a FULL path by my ISP. All they have given me is a folder called _Private which has read/write permissions.

Can any one help??? Please


<%
Dim name1,name2,email,company,address1,address2,address3,address4,username,password,password2,status
Dim strName,strUsername,strPassword,strCurrentStatus,path
Dim objCDO
path=&quot;/_private/pcl-user.txt&quot;
sender=Request.Form(&quot;email&quot;)
first_name=Request.Form(&quot;name1&quot;)
last_name=Request.Form(&quot;name2&quot;)
company=Request.Form(&quot;company&quot;)
add1=Request.Form(&quot;address1&quot;)
add2=Request.Form(&quot;address2&quot;)
add3=Request.Form(&quot;address3&quot;)
add4=Request.Form(&quot;address4&quot;)
username=Request.Form(&quot;username&quot;)
password=Request.Form(&quot;password&quot;)
validate=Request.Form(&quot;password2&quot;)
status=Request.Form(&quot;status&quot;)
Set objCDO=Server.CreateObject(&quot;CDONTS.NewMail&quot;)
' Variables for Read/Write > > > > > > > > > > > > > > > >
strName=Request.Form(&quot;name1&quot;) &amp; Request.Form(&quot;name2&quot;)
strUsername=Request.Form(&quot;username&quot;)
strPassword=Request.Form(&quot;password&quot;)
strCurrentStatus=&quot;Guest&quot;
Set fso=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
set file=fso.opentextfile(path,3,TRUE)
file.write(strName) &amp; vbcrlf
file.write(strUsername) &amp; vbcrlf
file.write(strPassword) &amp; vbcrlf
file.write(strCurrentStatus) &amp; vbcrlf &amp; vbcrlf
file.close
set file = nothing
set fso = nothing
' > > > > > > > > > > > > > > > > > > >
objCDO.From=sender
objCDO.To=&quot;webmaster@priory-campus.co.uk&quot;
objCDO.Subject=&quot;HLC Registration&quot;
objCDO.BodyFormat = 0
objCDO.MailFormat = 0
HTML=&quot;<html>&quot;
HTML=HTML &amp; &quot;<head>&quot;
HTML=HTML &amp; &quot;</head>&quot;
HTML=HTML &amp; &quot;<body>&quot;
HTML=HTML &amp; first_name &amp; &quot; &quot; &amp; last_name &amp; &quot; from &quot;&amp; company &amp;&quot; has completed the regitration form.&quot; &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot;Details are; <BR>&quot;
HTML=HTML &amp; &quot;Username: &quot; &amp; username &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot;Password: &quot; &amp; password &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot;<b>Company :</b>&quot; &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot; &quot; &amp; company &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot;<b>Address :</b>&quot; &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot; &quot; &amp; add1 &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot; &quot; &amp; add2 &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot; &quot; &amp; add3 &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot; &quot; &amp; add4 &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot;The user has requested &quot; &amp; status &amp; &quot; Status&quot; &amp; &quot;<BR>&quot;
HTML=HTML &amp; &quot;</body>&quot;
HTML=HTML &amp; &quot;</html>&quot;
objCDO.body=HTML
objCDO.Send
%>

<%
Response.Write(&quot;Thank You.&quot; &amp; &quot; Your current User Status is '&quot;&amp; current_status &amp;&quot;'&quot;)
%>
 
Hi,

When you set the path:
path=&quot;/_private/....&quot;
it can't find that folder. Where do u locate ur _private folder. If it under ur web folder then you should set the webrootpath and then set the path as follow:
<% 'set path
Dim webrootPath
webrootPath = Server.MapPath(&quot;..&quot;)
Path = webrootPath &amp; &quot;\_private\yourtxt.txt&quot;
'the rest u set is fine
%>

there is another way that u can do like:
<%
path=&quot;urDrive:/urfolder/urTxt.txt&quot;
%>
u need to declare as a full path ):

<% Hope this helps %>


GH
 
I am now getting the following error ;

Server object error 'ASP 0177 : 80070057'

Server.CreateObject Failed

/register.asp, line 44

When you said Web Root Path, do you mean the URL I FTP upload to ?

Sorry 2 b a pain ! ! !
 
I mean where you locate ur folder &quot;_private&quot;
Did u try both ways????



GH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top