I’m trying to make a PUT using Curlsmbs but it seems it’s not my day
The shell command working fine is:
curl -X PUT -H ‘Content-Type: multipart/form-data’ -F mykey[image]=@/Users/myname/Documents/001.jpg’ -u mylogin:mypass https://apiweb.com/imagesapi.json
and my code is:
[code]Dim MyCurl as CURLSMBS = new CURLSMBS
MyCurl.OptionUsername = mylogin
MyCurl.OptionPassword = mypass
MyCurl.OptionURL = “https://apiweb.com/imagesapi.json”
MyCurl.CollectDebugData = True
MyCurl.CollectOutputData = true
MyCurl.OptionUpload = True
MyCurl.OptionPut = True //just in case even if deprecated
//fPic is a FolderItem parameter
Dim ThisPic as picture = Picture.Open(fPic)
Dim buf as string =ThisPic.GetData(Picture.FormatJPEG,Picture.QualityLow) //change to high quality later
MyCurl.FormAdd(MyCurl.kFormCopyName,“mykey[image]”, MyCurl.kFormBufferPtr, buf, MyCurl.kFormBufferLength, lenb(buf))
// MyCurl.FormAdd(MyCurl.kFormCopyName,“mykey[image]”,MyCurl.kFormFile,fPic.NativePath) //also tried this way
MyCurl.FormFinish
Dim nReturn as integer = MyCurl.Perform[/code]
Using post with the same code works fine but now I need to use PUT and can’t get it working, no errors, just the image is not uploaded. I believe I’m not “translating” correctly the curl command to Curlsmbs.
Thanks for any help.