Forum Moderators: mack

Message Too Old, No Replies

ASP Creating a file

Can it be done using a virtual path?

         

chris_f

9:19 am on Oct 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi guys,

I realise most people are on their way to the conference so I might not get a quick response put here goes.

I am looking to create a file on the server. I am using the code below to achieve this:

set fs = CreateObject("Scripting.FileSystemObject")
set file = fs.CreateTextFile("C:\InetPub\WWWroot\test\testinc.asp", true, false)
file.WriteLine("<!--#include file='template.asp'-->")
file.Close

However, my sites are hosting through a shared server and I cannot, therefore, get access to it.

My problem is this. If using the above code I change the 'C:\InetPub\WWWroot\test\testinc.asp' to a path like 'testinc.asp' or 'pages/testinc.asp' etc... I get a permission error. I believe it is because the code above needs the FULL path. Am I correct? or Is there a way around this?

Chris.

DaveN

9:28 am on Oct 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



set file = fs.CreateTextFile(Server.MapPath(\test\testinc.asp"), true, false)

i think thats the correct syntax, anyway use the server.MapPath var

DaveN

chris_f

9:35 am on Oct 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



DaveN,

I could KISS you (but I'll refrain ;)). It didn't work before but I had the syntax wrong. Thanks.

Chris.

p.s. Genius

DaveN

9:55 am on Oct 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



chris
just visited your site love the passport photo on the about me

smiling isn't a crime LOL

see ya in the pub

DaveN

chris_f

10:16 am on Oct 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Pub Definitly,

That's the site I'm working on at the minute.

A new management system.

It will be a static with dynamically generated content and a complete content management system so no FTP is needed.

Chris.

DaveN

10:32 am on Oct 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



have you looked at aspupload and aspjpeg by persists if your host allows you to use them they a quite powerful

I have worked quite a bit on management systems track me down at the pub and I'll trade ideas and pitfalls if you want or just a have few beers anyway.

DaveN

chris_f

10:38 am on Oct 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll have to find me. You've seen the photo :).

BTW, did you know seeing the photo was punishable by either death or you getting the first round in ;).

Chris.

DaveN

10:53 am on Oct 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



it's okay i have had it blown up to A4 and printed on my tshirt saying "if you see chris tell him I'm at the bar".

See you tomorrow

Dave

chris_f

11:53 am on Oct 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



LOL