| | #1 |
| Active Warrior Join Date: 2008
Posts: 52
Thanks: 3
Thanked 0 Times in 0 Posts
|
I have done some reasearch on how to create files in ASP and found this script: <% thetext="Write this text in the file" Set fs = CreateObject("Scripting.FileSystemObject") Set wfile = fs.CreateTextFile("myfile.txt", True) wfile.Write (thetext) wfile.close Set wfile=nothing Set fs=nothing response.write("Text created") %> then I created an asp file containing only this script, named it "create" and uploaded it on one account on one asp-supporting free host. Then I tried to open that file using my IE6 browser and received an error message. Then I checked my file manager (on that free account) and saw that a new file (''myfile.txt") was not created. I think I am missing something here. Can anyone, please, explain to me what should I do in order to create files in ASP? |
| |
| | #2 |
| Active Warrior Join Date: 2008
Posts: 52
Thanks: 3
Thanked 0 Times in 0 Posts
|
Are you sure you posted this in the right thread? It seems to me that you were answering some other question, but not mine.
|
| |
| | #3 |
| Active Warrior Join Date: 2008
Posts: 52
Thanks: 3
Thanked 0 Times in 0 Posts
|
I also tried this script (I took it from here): <% dim fs,f set fs=Server.CreateObject("Scripting.FileSystemObject ") set f=fs.OpenTextFile(Server.MapPath("testread.txt"),8 ,true) f.WriteLine("This text will be added to the end of file") f.Close set f=Nothing set fs=Nothing %> I copied this script into an asp file that I named "experiment" (experiment.asp) and placed that file into the main folder on my free account that I had previously opened on a remote asp-supported free server. As far as I understand, since the last parameter in f=fs.OpenTextFile(Server.MapPath("testread.txt"),8 ,true) is "true", the new file (testread.txt) must be created in the same folder. However, after I created experiment.asp and tried to open it with my web-browser (IE 6), the new file wasn't created. Instead, I got this message: Server objecterror 'ASP 0177 : 800401f3' Server.CreateObject Failed /experiment.asp, line 5 800401f3 Why is it so? |
| |
| | #4 |
| Banned |
I don't really know ASP. But try to change the folder's permissions. "CHMOD" the folder to 0777. and also check if there is any command in ASP to chmod files, because maybe you need to chmod the new file that created before writing something in it. |
| |
| | #5 |
| Active Warrior Join Date: 2008
Posts: 52
Thanks: 3
Thanked 0 Times in 0 Posts
| ofir wrote: ""CHMOD" the folder to 0777. and also check if there is any command in ASP to chmod files" - how do I do it? |
| |
| | #6 |
| Warrior Member Join Date: 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
Because of virus threat many servers wont allow you to use scripting objects like creating files & folders. which your error seems to indicate. why not go in for PHP its free and supported by almost all webhosts and u have a large community to get u through if any problem should arise |
| |
| | #7 |
| Active Warrior Join Date: 2008
Posts: 52
Thanks: 3
Thanked 0 Times in 0 Posts
|
Thanks for telling me that - finally I know the reason.
|
| |
| | #8 | |
| Active Warrior Join Date: 2008
Posts: 52
Thanks: 3
Thanked 0 Times in 0 Posts
|
in order to see it: "Is there any web-page copying command in PHP" ), but I stumbled on a similar problem: the allow_url_fopen is not allowed on free PHP servers. | |
| |
|
| Bookmarks |
| Tags |
| asp, create, file |
| |