Title: Send File from PHP WebServer to RTC Web Server Post by: sanche on February 23, 2015, 03:03:49 PM Config:
1. Server 1 PHP, Default UTF-8 Send Message: Code: POST http://www.server2site.com/upload HTTP/1.0\r\n 2. Server 2 RTC HTTP Server Upload Function (QuickStart\BrowserUpload) Code: procedure TUploaderDM.UploadProviderDataReceived(Sender: TRtcConnection); Results: Upload with Browser to Server2 nice work! Upload from Server1 not work. Params of Request included only: name, filename IsFile name and filename = false Sending file included by Request, but not parsed. How to accept file from Server1? Thank you. Title: Re: Send File from PHP WebServer to RTC Web Server Post by: D.Tkalcec (RTC) on February 23, 2015, 05:46:06 PM I can not help you with questions about the use of PHP and 3rd-party Servers, but I don't see the file content body in your "POST" code. What I see is the name of the file, without content. Are you sure the code you have used in your PHP file is correct and the file you are trying to send exists on the 3rd-party Server at the location you have specified in the PHP Script?
On the RTC side, you have two options. If the content being posted to the RTC Server is compatible with the format used by Web Browsers when uploading files, then you can use the "Request.Params" property to have RTC parse the content and give you easy access to the uploaded file (as in the "BrowserUpload" example). But if the 3rd-party Client or Server is NOT using the same format as used by WebBrowsers for uploading files and sending "form post" data, then you will have to manually parse the content received. You can always use the "Read" or "ReadEx" method to get the content body sent to the RTC Server and then write your own code or use 3rd-party code for parsing that content and extracting the data you need. Or ... instead of using some special format as an "envelope" for the file, you could try sending the file content in binary format as content body of a "PUT" request. That should work from any source and won't require special content parsing. The content you get from the "Read" or "ReadEx" method would be the actual file. You can either URL_Encode the file name as part of the URI or send it as a custom HTTP header value. To accept the file on the RTC Server side, you would use code similar to the "ClientUpload" example in the QuickStart folder. Best Regards, Danijel Tkalcec Title: Re: Send File from PHP WebServer to RTC Web Server Post by: sanche on February 23, 2015, 08:46:41 PM PUT method works fine!
Thanks a lot! Title: Re: Send File from PHP WebServer to RTC Web Server Post by: D.Tkalcec (RTC) on February 23, 2015, 08:55:54 PM Thank you for your feedback.
Best Regards, Danijel Tkalcec |