简体   繁体   中英

send from client side to google apps script (server) base64 string

I have this base64 string that represents a picture that I need to send to the server. All of the ajax requests just append the data to the query string to send to the server through the url and a query string/url sort of has a limit of 2,000 characters. Well my base64 string is around 97,000 characters so how do I get this thing over to the server?

POST - this would use url and restrict to 2000 characters...right? GET - same as post...right?

what else could I do? Convert it to a blob? what would you do if you knew what you're were doing.. because I dont lol

thanks for your time!

我更喜欢使用FormData对象,它非常简单明了,您可以在此处找到整洁的教程。

Use json to post the data:

 fetch('url', { method: 'post' headers: new Headers({'Content-Type': 'application/json'}), body: JSON.stringify({'payload': 'base64str'}) }) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM