Forums

Ia it possible to use chronoforms to edit a text file?

jbudd 27 Oct, 2009
I am using Simple Image Gallery, which will display a thumbnail gallery of all images in a folder.

It takes captions from a file labels.txt in the folder, which has the format
filename1.jpg|This is the label for the first picture
filename2.jpg|This is the label for the second picture
.
.
.

Users can upload new pictures, delete or replace existing ones from the site front end, but I dont know any way for them to edit labels.txt on the server (ie not download, edit locally, upload) apart from back end tools such as extplorer.

I guess the form should have a dropdown list of folders images/stories/*
On selecting a folder it should allow the user to edit just labels.txt in that folder.

Is it possible?

Thanks,
jb
nml375 27 Oct, 2009
Hi jb,
This should be very possible, although it will require some custom coding.
The most simple way would be to load the contents of the file into a textarea input in your form, and on your submit code, write whatever was submitted back to the file.

Some caution would have to be observed, as to not break the form html with the file content, should it contain valid html-words such as </textarea> or </form>. Also, you would have to handle file-locking in some manner, unless you'd be willing to risk having two users editing the same file at the same time.

Once all this is working, it should'nt be too hard to extend the form to handle multiple files/location by means of form inputs.

/Fredrik
This topic is locked and no more replies can be posted.