Linking to a created file

Y

ytoledano

Hi,
I'm using PerlScript in my ASP page and I have the following problem:
Each time the page is refreshed a CSV file is created. I want this file
to be available for download. The problem is I can't create the file in
the "wwwroot\site" dir, so I can't link to it. I can however create
anywhere else on the server.

Thanks in advanced.
 
S

Steven Burn

Give this a try;

<%
'// incFunctions.asp

'// Ensure used vars are declared
Option Explicit

'// Const for the FileSystemObject
Const c_Read = 1 '// Read a file

'// Function: ReadFile
'// Purpose: Read the content of a file
'//
'// Usage:
'//
'// Dim strData: strData = ReadFile("..\private\myfile.txt")
Function ReadFile(sFile)
Dim objFSO, objFile '// Declare used vars
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(Server.MapPath(sFile), c_Read)
ReadFile = objFile.ReadAll()
Set objFSO = Nothing '// ALWAYS cleanup
End Function
%>

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
Y

ytoledano

Well, I'm using PerlScript, and also I don't have access to the project
till Tuesday.
But I have 2 more questions:
Could it be because I don't have premssion to write to the wwwroot\site
folder?
What permssions does the user which compiles the page have?

Thanks
 
M

Mike Brind

Well, I'm using PerlScript, and also I don't have access to the project
till Tuesday.
But I have 2 more questions:
Could it be because I don't have premssion to write to the wwwroot\site
folder?
What permssions does the user which compiles the page have?

Thanks

If you have tried writing to the wwwroot\site directory and received an
error message about permissions, then you need to ensure that the
IUSR_machinename account has write permissions for that folder.
 
E

Evertjan.

wrote on 18 mei 2006 in microsoft.public.inetserver.asp.general:
I received no error, the file simply wasn't written there.

Might we know what you are talking about?
 
Y

ytoledano

The reason I can't link to the file I just created is that I can't
create it in the wwwroot\site directory. I open the file for writing,
and then write text into it. When I open the site it loads correctly
but the file isn't created. Therefore, I receive no error.
 
E

Evertjan.

wrote on 18 mei 2006 in microsoft.public.inetserver.asp.general:
The reason I can't link to the file I just created is that I can't
create it in the wwwroot\site directory. I open the file for writing,
and then write text into it. When I open the site it loads correctly
but the file isn't created. Therefore, I receive no error.

I still do not know what you are talking about.

Please quote what you are replying to. If you want to post a followup via
groups.google.com, don't use the "Reply" link at the bottom of the article.
Click on "show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
<http://www.safalra.com/special/googlegroupsreply/>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top