Search a easy way for file upload

with the function "LoadFromFile" I load data from the server into a memo.

memo1.Lines.LoadFromFile(HostWebDir + 'webdata.ini');         work

If I now want to save a memo1 on the server with "SaveToFile", this does not work.
It comes the Save query. But the file is then on my PC under download and not on the server under the specified directory.

memo1.Lines.SaveToFile(HostWebDir + 'webdata.ini');           not work

Make this with a "TWebHttpRequest" this not work.

In can read files with Get from the server, but cannot load files with Post to the server.
(The error 405 appears)

whtwebdata.ResponseType := rtText; 
whtwebdata.Command      := httpGET;
whtwebdata.URL          := HostWebDir + 'webdata.ini';
whtwebdata.execute; --> data via whtwebdataRequestResponse    work
whtwebdata.ResponseType := rtText; 
whtwebdata.Command      := httpPost;
whtwebdata.PostData     :='Teststring';  
whtwebdata.URL          := HostWebDir + 'webdata.ini';
whtwebdata.execute;                                           not work

Get and Post-Headers is set to (default)
Cache-Control=no-cache, no-store, must-revalidate

Therefore my question, how can I post/save a simple text file on the server.
Or, what do I have to change where to make it work.

I didn't find anything in the examples.

You are actually at client-side, which means that you cannot access HostWebDir as it does not exist. The HostWebDir exists at server side. so the SaveToFile Memo1 approach will not work. The second approach will work, but not with the code you wrote setting the URL directly to webdata.ini. First of all, your webserver needs to be configured to accept POST requests and post data and then save that data to the file when the request is accepted. I suggest to start looking at a couple of guides that direct you into how to configure and setup a server that listens to requests from your client.

https://doc.tmssoftware.com/biz/xdata/guide/web.html
http://www.tmssoftware.net/public/EMS_WEBCORE_Article.pdf

All right.

Already thought that it could be something like that.
But I was hoping that TMS had already solved it. :grin:

Will follow up on this Links.

A thank you for the great and fast support.
It is really fun to work with the product TMS-Webcore.

Hi,

Thank you for your kind feedback!