Autore Topic: gb.net.curl - Come caricare file binari  (Letto 401 volte)

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.724
  • Ne mors quidem nos iunget
    • Mostra profilo
gb.net.curl - Come caricare file binari
« il: 23 Febbraio 2013, 23:22:37 »
Riporto questa discussione apparsa nella M.L.I.:

« I have been working on a small project syncing data with Google through their
 data  API.

 Most of the communication works well using the HttpClient from the gb.net.curl
 component, but I struggling to get mimic the following curl command line.

 curl --silent --request POST --data-binary "@sweeping_the_rock.png"  \
 --header "Slug: Sweeping the rock" --header "Content-Type: image/png" \
 --header "Authorization: GoogleLogin auth=ABCDEFG"
 "http://picasaweb.google.com/data/feed/api/user/brad.gushue/albumid/5113621341847124417 "

 I don't want to open the file and read fully first, as it can become rather
 large, so I prefer to read it /pipe to the curl stream.
 Currently I reverted to using the Shell command but I consider that only a
 workaround with a curl component already existing.

 A small code snipplet would be great help.

Thanks a lot in advance.

Ulf
»



« Does the following work when the file is not too large?

MyHttpClient.URL =
"http://picasaweb.google.com/data/feed/api/user/brad.gushue/albumid/5113621341847124417 "
MyHttpClient.Post("image/png", File.Load("sweeping_the_rock.png"),
["Slug: Sweeping the rock", "Authorization: GoogleLogin auth=ABCDEFG"])

--
Benoît Minisini
»


« I have added a PostFile() method in the revision #5560.
Does it fit your needs?

--
Benoît Minisini--
Benoît Minisini
»
« Ultima modifica: 24 Febbraio 2013, 14:03:06 da vuott »
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »