• Sending a multipart file upload in GMOD?
    4 replies, posted
Hey Facepunch, So recently I have been doing some machine learning coding, and have run into a problem. I am having lua code capture my screen with [CODE]render.Capture( table captureData )[/CODE], but can't upload it. I am very unfamiliar with how multipart works, I got this working in Java to push images to an offsite api, but don't know the lua equivalent. [B][U]TLDR; How do I upload a render.Capture() to a web service like imgur using lua?[/U][/B] I don't need spoonfeeding, but if someone can help explain how multipart works (especially in lua), I can be on my merry way. Thanks!
[QUOTE=BlueMustache;50347083]Hey Facepunch, So recently I have been doing some machine learning coding, and have run into a problem. I am having lua code capture my screen with [CODE]render.Capture( table captureData )[/CODE], but can't upload it. I am very unfamiliar with how multipart works, I got this working in Java to push images to an offsite api, but don't know the lua equivalent. [B][U]TLDR; How do I upload a render.Capture() to a web service like imgur using lua?[/U][/B] I don't need spoonfeeding, but if someone can help explain how multipart works (especially in lua), I can be on my merry way. Thanks![/QUOTE] You don't need to split it if you want to upload it to imgur, I made a script for this but lost it :( [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/HTTP]HTTP[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/Base64Encode]util.Base64Encode[/url]
[QUOTE=Kevlon;50347114]You don't need to split it if you want to upload it to imgur, I made a script for this but lost it :( [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/HTTP]HTTP[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/util/Base64Encode]util.Base64Encode[/url][/QUOTE] Dang. Thanks. Although, it's not imgur, I wish it were that simple. I'm uploading them to this. [url]https://market.mashape.com/imagesearcher/camfind[/url] I won't make much sense up front, but I'm teaching my servers what every prop I pick up is, and then stores it in a database. So if I tell it, "Bot. Pick up the Hula Girl", then it will know what prop is associated with "Hula Girl".
[QUOTE=BlueMustache;50347145]Dang. Thanks. Although, it's not imgur, I wish it were that simple. I'm uploading them to this. [url]https://market.mashape.com/imagesearcher/camfind[/url] I won't make much sense up front, but I'm teaching my servers what every prop I pick up is, and then stores it in a database. So if I tell it, "Bot. Pick up the Hula Girl", then it will know what prop is associated with "Hula Girl".[/QUOTE] Sounds cool, even though there is a more efficient way of doing that. But you can see the POST api right there on their home page, just use that with HTTP. [sp]as it can set headers and it took me 1 hour to find that cause zerf removed it from the wiki[/sp]
Anyone have an idea on how to upload the binary part of the post request?
Sorry, you need to Log In to post a reply to this thread.