I have no solid advice for you, but maybe one of these ideas will work out.
Most (all?) of curl’s diagnostic output goes to stderr, but do shell script will never show the stderr output unless the last command has an non-zero exit code. So there are two things you might want to do: make the shell abort the script if a non-last command exits with a non-zero exit code, and redirect stderr to stdout so that you can see if curl is trying to tell you something that do shell script would ordinarily quash. You can prepend “set -e;exec 2>&1;” to your command text to accomplish both of these.
The ‘current working directory’ (as output by the pwd command or shell built-in command) is different between a typical Terminal session and do shell script. Terminal starts out in your home directory where you are allowed to create files. do shell script (usually) starts out in the root of your boot drive. If you are not an administrator you may not be able to create files there. The file that caught my eye is the cookie file. You may want to either include a ‘cd’ command to change to your home folder first, or you may want to specify the full path to your cookie file in both curl commands.
The ‘cd or use full-path’ issue also applies to your --data-binary argument, but it looks like you are already taking care of that one by using a full path.
You build the value stored in fullPathU from the values in srcFldrUproper and Tfilex, but immediately after that, you change the value of Tfilex. Is this because you want to “hard code” the value for the X-siLock-OriginalFilename header, or did you intend to hard code the filename of the local file passed to curl’s --data-binary option?
The static headers that you are sending all include spaces before the values, but the dynamic ones do not include a space there. RFC2616 (HTTP/1.1), section 4.2: Message Headers says that the white space is not supposed to matter, but maybe the server to which you are posting requires it.
Is your fullPathU file actually of type multipart/form-data? The curl from Tiger understands “-F fieldname=@/path/to/file” to mean “upload the file into the specified form field name”, but maybe that option does not exist in your curl. If it does, you could probably use it to skip having to manually build the encoded form data.
Last, some AppleScript items.
info for comes from the StandardAdditions OSAX, so it does not need to be in the Finder block. Also, Finder can tell you the size itself, so there is no need for the OSAX. Just tell application “Finder” to set sizeFile to size of item 1 of (get selection) and then put the rest of your code outside any explicit tell block.
You may end up with unexpected values for X-siLock-FileSize if you send large files. I was testing with a 15MB file selected and ended up with “X-siLock-FileSize:1.5973776E+7”. You could use numValue div 1 to try to get an integer, but that only works up to 2^29-1 (536870911; any size below exactly 0.5GiB). Beyond that you are stuck with reals and you would need some way to format them yourself (or at least remove the notation from the standard string representation). Maybe Nigel Garvey’s numToStr would be useful there.
You can use embedded (and shell-escaped) newlines in the do shell script text to make it a bit easier to read:
do shell script ("
curl -k -v \\
-c cookie2.txt \\
curl -k -v \\
-b cookie2.txt \\
--data-binary @" & quoted form of POSIX path of fullPathU & " \\
-H \"Content-Type: multipart/form-data\" \\
-H \"X-siLock-AgentBrand: cURL\" \\
-H \"X-siLock-AgentVersion: 7.16.2 \" \\
-H \"X-siLock-FolderID:506436921\" \\
-H \"X-siLock-OriginalFilename:" & Tfilex & "\" \\
-H \"X-siLock-FileSize:" & sizeFile & "\" \\
When changing stuff around the end of the line, just be sure not to lose the white space before the backslash. Also be sure that the backslash is the last character on the line.