How to upload html page through webwrite?

조회 수: 7 (최근 30일)
Abhishek Ballaney
Abhishek Ballaney 2017년 4월 12일
댓글: Guillaume 2017년 4월 12일
How to upload html page through webwrite function?

답변 (1개)

Guillaume
Guillaume 2017년 4월 12일
편집: Guillaume 2017년 4월 12일
Same as your previous question, this all depends on the web server you want to upload to. If it's the thingspeak server, I don't think it supports that. But as I said before, I've never used it, this is just based on a quick reading of the thingspeak doc.
It's a strange scenario that you want to upload html to a web server from a client. Usually, it's the server that sends html to a client.
  댓글 수: 2
Abhishek Ballaney
Abhishek Ballaney 2017년 4월 12일
HTML is basically text. So we can send from client to server also. How to handle this case?
Guillaume
Guillaume 2017년 4월 12일
Again, it all depends on the server. There's no universal method to send text to a server. By definition a server sends information to the client, not the other way round.
Now, using a REST API a server can receive information from a client. The server will define how that information is to be sent, and how it is to be encoded.
If you have a url that expects some html file, then possibly:
htmlcontent = fileread('yourhmtlfile.html')
webwrite(someurl, hmtlcontent, weboptions('MediaType', 'text/html'))
may work, if that's how the server expects it. It won't otherwise. The documentation of whichever service you want to use should tell you how it expects to receive data.

댓글을 달려면 로그인하십시오.

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

Help CenterFile Exchange에서 Read Data from Channel에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by