/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] CreateTextFile Not Creating File Where Needed

I’ve written a script that exports records from a database and creates an XML file from those records. The script works fine if I’m creating the file in that websites directory, but if I want to create it else where on that server it won’t write. Can anyone tell me what I’m doing wrong?

[COLOR=”Red”]Works:[/COLOR] Site 1 writing to folder in Site 1’s directory.

[CODE]
Set strCreate = fso.CreateTextFile(server.mappath(“/Exported Files/File.xml”), true)
[/CODE]

[COLOR=”Red”]Doesn’t Work:[/COLOR] Site 1 writing to folder in Site 2’s directory.

[CODE]
Set strCreate = fso.CreateTextFile(server.mappath(“D:Websites/Site2/Exported Files/File.xml”), true)
[/CODE]

to post a comment

2 Comments(s)

Copy linkTweet thisAlerts:
@KuriyamaAug 05.2009 — I've written a script that exports records from a database and creates an XML file from those records. The script works fine if I'm creating the file in that websites directory, but if I want to create it else where on that server it won't write. Can anyone tell me what I'm doing wrong?

[COLOR="Red"]Works:[/COLOR] Site 1 writing to folder in Site 1's directory.
[CODE]
Set strCreate = fso.CreateTextFile(server.mappath("/Exported Files/File.xml"), true)
[/CODE]


[COLOR="Red"]Doesn't Work:[/COLOR] Site 1 writing to folder in Site 2's directory.
[CODE]
Set strCreate = fso.CreateTextFile(server.mappath("D:Websites/Site2/Exported Files/File.xml"), true)
[/CODE]
[/QUOTE]



Why do you need server.mappath if you already have the file path? Try this. . .

[CODE]Set strCreate = fso.CreateTextFile("D:Websites/Site2/Exported Files/File.xml", true)[/CODE]
Copy linkTweet thisAlerts:
@nbcrockettauthorAug 05.2009 — Thanks for the help. The server.mappath thing was copied over from something else and it didn't even cross my mind to remove it. In the words of Carlos Mancia "dee dee dee"
×

Success!

Help @nbcrockett spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...