Write information from the textarea to text file on the server
Author: Tom G.
Visited 1515,
Followers 2,
Shared 0
In the project I have created, I’m using a text file, where I keep the information to be displayed on the page. The information in the text file can be changed, so the page changes automatically. No need for any code change. Works really great.
And here is my problem.
Up till now, I manually edited the file on the server.
Recently I have created another page on which I can edit the information that I would like to put in the existing text file and display on the main page. The problem I have is putting the information from the <textarea> into the text file.
Anyone has a clue if this can be done? I can read from the file but I cannot write edited information to the file.
Any help will be appreciated.
Posted on the
Hello Tom,
here a cool plugin to manage a directory listing
https://wsx5.afsoftware.fr/viewforum.php?f=125
And you can manage your files directly from the web.
Online demo here into Plugins section
https://wsx5demo.afsoftware.fr/index.html
Regards
https://wsx5.afsoftware.fr
Author
Hi, it looks interesting!
But I think I need a login name and password to your page. I think I had it before, but I forgot...
What now?
Tom.
send me an email. I will check your previous registration.
Author
I can't find your email address...
axel
at
afsoftware.fr
Author
Thank you, Axel. I was able to login and download the DL plugin.
I followed instructions in the provided .pdf file (DL via a HTML pop-up). Uploaded the project.
Something didn't work: all I got is blank page with one line:
Just that. Nothing happens when clicking on it...
Author
I don't know if this solution is what I was looking for, even if I get it running.
You can check the page I am working on : http://www.ownitconsignment.com/ .
1. In the main menu choose EVENT. The text and generated map you see come from the information in the text file, which I am right now changing manually.
2. Press “[ctrl]e” - the editor window will open.
3. Put text as instructed.
4. Click on “Show HTML” button. Now the “Send Text to File” button will be active. Click it.
5. I want to write the information from the editor into the file (hard coded file name).
This is the idea.
Tom
PHP 7.0 ?
there is some errors with PHP 7.2 and +++ I think
And your example is nice too.
Tom,
I have checked again into the WSX5demo project... and it works
to opening the popup window with Directory Listing the HTML code into your HTML object must be with this code
(plus files into the advanced tab like described into PDF file)
<script type="text/javascript">
<!--
function open_infos()
{
width = 600;
height = 400;
if(window.innerWidth)
{
var left = (window.innerWidth-width)/2;
var top = (window.innerHeight-height)/2;
}
else
{
var left = (document.body.clientWidth-width)/2;
var top = (document.body.clientHeight-height)/2;
}
window.open('afs-demo/directory_listing/afs_index.php','nom_de_ma_popup','menubar=no, scrollbars=no, top='+top+', left='+left+', width='+width+', height='+height+'');
}
-->
</script>
<a href="#null" onclick="javascript:open_infos();">Opening Directory Listing via a HTML pop-up </a>
If not download the project and investigate it
http://wsx5.afsoftware.fr/viewforum.php?f=111
https://wsx5.afsoftware.fr
Author
wsx5.afsoftware,
your link points to eCommerce demo not to Directory Listing...
Tom,
Ok I need to change the demo name. was for e-Comemrce as first demo. But now a lot of things :-)
Author
Thanks, I should have checked...
Author
I got it working! It was a matter of editing the afs_config.php file. I can now edit and save file(s) on server.
Couple small things:
Login and password are visible - how can I force the user to write login and password every time they use program?
The popup window is pretty small - how can I change the dimenssions, make it bigger?
In the folder which I'm displaying, there are files and subfolders - how can I show one or two files and no subfolders? The files have totally different names, so the wildcard cannot be used.
As I said before, this is working, but it's not how I visualized it. I wanted to have some code behind the button, which would write the file automatically and directly (using jQuery, PHP, etc.). So, if somebody knows how to do it, please post!
And special thanks to Axel! I have learned interesting new stuff from you!
Hey Tom,
Glad to see that it's working now...
But Which version are you using... Latest Directory Listing is 2.1 (https://wsx5demo.afsoftware.fr)
Password:
I don't understand. here the login window with stars for the password !!!
And the password into afs_config.php are crypted like:
//
// Password encoding
// MD5 or SHA256 or SHA512
//
$PasswordEncoding = 'MD5'; /* 'MD5' or 'SHA256' or SHA512': Only one choice */
Popup window
Again I don't undestand because the popup is an HTML window and you can enlarge it like any window
Files / Folders restrictions
Tom, read the afs_config.php file. There is all comments for usage of each option
Check the Files & Folders section
Regards
https://wsx5.afsoftware.fr
Author
Thank you for your response.
I'm using yout newest - 2.1.
As you can see on your snapshot, the password (shown as dots) is there. So anybody can just click "Log in" and get to files. Can Username and Password show blank, so that it has to be filled every time? As for enlargement of the window - I sure can see that. But in your example the initial window is large, shows much more. Mine is small...
And how to show just one or two files and no subdirectories? In my case in the "files" folder I store many different files and I don't what them to be touched.
Clear your cache for the login/password. previous informations have been memorized by your browser.
Login / Password
Here into a fresh browser, no data are already present
Directories
Again Tom, read the afs_config file !!!
to hide some directories it's explained inside
Before:
After (to remove directories from the list)
Windows size
Into my WSX5 demo project, you can see how to change the windows size into the 'DL via Windows' page into plugin section.
But you can also to choose the iframe usage into same page
http://localhost/demo/dl-via-iframe.html
Enjoy!
https://Wsx5.afsoftware.fr
Author
Thanks a lot, asf!
You are very patient, thank you for that! I hope I now have enough information.