Forum Moderators: open

Message Too Old, No Replies

Create A file on webserver with ASP

Create or Edit a file on website home directory

         

abulhallaj

4:18 pm on Oct 19, 2003 (gmt 0)

10+ Year Member



How can create a file on my homesite directory or edit it. I need this code working on Windows 2000 server with NTFS file system.

Ex: when i excute an asp page it's automatically create a html file that contain some data on server.

aspdaddy

4:23 pm on Oct 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use the filesystem object to create files

http*//www.w3schools.com/asp/met_createtextfile.asp

abulhallaj

8:30 pm on Oct 19, 2003 (gmt 0)

10+ Year Member



thanks a lot for this link

but if i want to write a larg amount of data into this file and use a code like that , it work?


do until rsNews.EOF
tfile.WriteLine("<% = rsNews("ITEM") %>")
rsNews.MoveNext
loop

have a code to write multiply lines?

macrost

2:06 pm on Oct 20, 2003 (gmt 0)

10+ Year Member



Well if you are going to be writing a large amount of data, you just might want to look at a database solution.
Mac

martyt

4:11 pm on Oct 20, 2003 (gmt 0)

10+ Year Member



The web user account will need to have write privileges in the directory you want to create the file. If you're running on a hosted web server, the admins will have to set that permission for you.

abulhallaj

7:59 pm on Oct 20, 2003 (gmt 0)

10+ Year Member



i use windows 2000 server for my host and i think windows 2000 have not let set peremision on directories.!?

abulhallaj

8:02 pm on Oct 20, 2003 (gmt 0)

10+ Year Member



you just might want to look at a database solution.

I use database plan but i need it to generate my Archive files as HTML files.

mattur

9:12 pm on Oct 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



aspdad pointed the way: you can use the filesystemobject to generate a static file. Have a go.

With an ASP page your code generates html and sends it to the response. With the filesystemobject method your code will basically be the same but you will instead add the generated html to a file using the filesystemobject.

As said above, you will need to make sure the web user account has correct permissions to wherever you are writing the file. In windows 2000 you need to set the approp. ntfs permissions. HTH.