-
Edit .txt file on server
I know you can edit text files with ActiveX on your comp., but I'm wondering if this can be done on a server (FTP). I completely threw away the idea of a MySql database, so I'm trying to find an alternate route. Thanks
- Mike
-
-
Using FTP, I've always just edited the file then uploaded it. You can open and do relatively simple operations to text files and close them using asp. With a little creativity, this could be 'editing'. PHP includes the same basic, if not more, functionality in this regard, as far as I know (not much experience with PHP or asp but, I have messed with text files using asp and it works.
-
-
I want the user to be able to do it -- to have a page where the user can do it dynamically. I understand what you're saying though, and thanks.
- Mike
-
-
My server won't let me use asp though, so I'll have to look into PHP.
- Mike
-
-
There's no need to use FTP. A script on the server will (presumably) be running as the user to whom the file belongs, and so will have read and write access to it.
-
-
In your last thread on this topic I mentioned a free PHP add-on that allows editing and more. From what it says on the info page, you can control who gets to edit and what files are available to edit. Here is the URL again:
http://www.phpxplorer.org/phpXplorer/webIndex.php
I'm not recommending this, haven't used it but, looks promising and it is free.
I'm sure it must be possible to work out a simple editor by importing the text of a text file to a textarea, editing it there, and then submitting it to a page that would then write the new value to the same text file (perhaps, if need be, deleting the old version first). The program I mention above is much more involved but, presumably they have already worked out most of the details. It may require access to the server to install it though.
-
-
Yeah. I saw that, but I couldn't get it to work. I posted my question this time, in a different way to try to get some different answers.
- Mike
-
-
Argh... My webhost disabled system() and exec() commands in PHP. So I can't even do that. This is horrible. Are there any alternatives to system() ?
This is the dos line I used:
Code:
echo test > test.txt
- Mike
-
-
try fopen()
if that fails, then you likely won't be able to do anything with files.
But, if it works, then you can open the file into a variable and edit it all you want, then use fwrite() to save it.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
- Mike
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks