Answer the question
In order to leave comments, you need to log in
How to send an image via POST request?
Good afternoon.
Google Apps Script has a script that takes an attachment (picture) from a letter and sends it in a post request to the site:
var attachment = message.getAttachments()[0]
var header = {
'Authorization': 'Basic ' + encoded,
'Cookie': cookies.join(';')
};
var payload = {
"headPicture": attachment2,
"Name": title,
"pageType": "news",
};
var opt = {
'method': 'post',
'headers': header,
'payload': payload
};
var response = UrlFetchApp.fetch("https://www.site.ru/admin/add", opt);
Answer the question
In order to leave comments, you need to log in
I think this will help the section - Uploading files with multipart / form-data (there are some features when uploading pictures and more or less large files)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question