FTP upload with lib curl

BlitzMax Forums/Brucey's Modules/FTP upload with lib curl

Blueapples(Posted 2010) [#1]
Getting this error from curl.perform():

Failed: Operation was aborted by an application callback (42)

I'm trying to use the setReadStream method of TCurlEasy. This appears to be uploading only part of the file, then failing with the above error code.

This is the code that sets up the upload:

stream = OpenFile(watchDir + "/" + file, True, True)

Print watchDir + "/" + upFile + " " + FileTimeWithFormat(watchDir + "/" + file, "%d %b %Y")
curl = TCurlEasy.Create()
curl.setOptString(CURLOPT_URL, "ftp://" + username + ":" + password + "@" + server + "/" + path + "/" + upFile)

curl.setOptInt(CURLOPT_UPLOAD, True)
curl.setReadStream(stream)

result = curl.perform()
If result = 0 Then
	Print "uploaded: " + result
	SetGadgetText(status, "Uploaded: http://" + server + "/" + path + "/" + upFile)
	ListAddLast(uploadedFiles, file)
Else
	If result = 67 Then badCredentials = True
	SetGadgetText(status, "Failed: " + CurlError(result) + " (" + result + ")")
EndIf


What am I doing wrong?


Brucey(Posted 2010) [#2]
Does this help any?


Blueapples(Posted 2010) [#3]
Awesome, worked perfectly Brucey. Thanks a ton.