The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> write file on server side
DS92
post Feb 3 2019, 11:12 AM
Post #1





Group: Members
Posts: 5
Joined: 5-October 16
Member No.: 24,870



Goodmorning, I would like that input on html page are automatically saved in a txt file on server. I found that it could be reach with javascript and php scripts but I couldn't understand how.
The next step could be modify the file and read it in order to find if the client input are already in the file.
Could someone help me? thank you very much
Best Regards
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Feb 3 2019, 11:41 AM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,316
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



What server-side programming languages can you use? PHP? Python? Perl?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Feb 3 2019, 02:05 PM
Post #3


.
********

Group: WDG Moderators
Posts: 8,238
Joined: 10-August 06
Member No.: 7



Good evening!

QUOTE(DS92 @ Feb 3 2019, 05:12 PM) *

input on html page are automatically saved

Do you mean after the user submits a form, or automatically while the user types?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
DS92
post Feb 4 2019, 04:48 AM
Post #4





Group: Members
Posts: 5
Joined: 5-October 16
Member No.: 24,870



Thank you very much, I would like that when I submit start a javascript which call a php o nodejs code to save user inputs in file txt or change txt file. I available to write server side in python php or nodejs codes. I don't know Perl code
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Feb 4 2019, 11:03 AM
Post #5


.
********

Group: WDG Moderators
Posts: 8,238
Joined: 10-August 06
Member No.: 7



QUOTE(DS92 @ Feb 4 2019, 10:48 AM) *

Thank you very much, I would like that when I submit start a javascript which call a php o nodejs code to save user inputs in file txt or change txt file.

You don't need javascript for that, just use the server-side script's URL in the form's ACTION attribute and the script will run automatically when the form is submitted. But if you must use javascript, it can be done with an Ajax request.

QUOTE
I available to write server side in python php or nodejs codes. I don't know Perl code

Wth PHP this one can be used: http://php.net/manual/en/function.file-put-contents.php

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
DS92
post Feb 5 2019, 09:43 AM
Post #6





Group: Members
Posts: 5
Joined: 5-October 16
Member No.: 24,870



Thank you very much for your answer. I tried with AJAX method but always appears in visual studio code the following error:
Failed to load resource: the server responded with a status of 405 (Method Not Allowed) [http://127.0.0.1:5500/test.php];

could some one help me to solve also this problem? I read about web.config file but I don't know if it could be usefull and how to create and call it from html page in visual studio code.
Thank you very much
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Feb 6 2019, 02:39 PM
Post #7


WDG Member
********

Group: Root Admin
Posts: 8,316
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



When I've seen 405 Method Not Allowed, it has been either because a form was trying to POST to a static web page that could only be retrieved via GET, or because a link was trying to access a form-handling URL via GET when the server-side program would accept only POST.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Feb 6 2019, 04:25 PM
Post #8


Programming Fanatic
********

Group: Members
Posts: 1,672
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



I've seen the '405 Method Not Allowed' error when the page is .htm or .html and it tries to make a POST ajax call. I use IIS web server so I've run into it. I think IIS only allows GET ajax calls (unless you reconfigure the web server).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Daniel Feenberg
post Feb 19 2019, 11:32 AM
Post #9





Group: Members
Posts: 1
Joined: 19-February 19
Member No.: 26,826



Does anyone know where the format of the input to the server script is detailed? That is, the server script reads from the standard input and the sections are delimited by headers such as:
------------0xKhTmLbOuNdArY
Content-Disposition: form-data; name="userfile"; filename="test.txt"
Content-Type: text/plain

but I can't find where this is documented. It doesn't seem to be in RFC3875.

Daniel Feenberg
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th October 2019 - 07:00 PM