[futurebasic] Re: [FB] FTP curl download question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2006 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Wed, 22 Nov 2006 18:54:28 -0700
This assumes:   %{size_upload}  was passed in the command string to  
open unix.  Something like:

curl -T /Users/brianstevens/Desktop/TestFile ftp:// 
userid:password@... -w '\rUploaded size: %{size_upload}' 2>&1

On Nov 22, 2006, at 6:26 PM, Brian Stevens wrote:

> Thanks Doug!  Good stuff. I'm trying to move my code away from  
> deprecated URL manager.
>
> In case this helps(and I gleaned this from one of Ken's demos):    
> An upload with curl will report back how many bytes were uploaded  
> (or zero if it failed). Even though this doesn't say why it failed  
> it is a start. The following pseudo code is not a demo but  
> illustrates the timing.
>
> local fn DoMyUnixStuff (cmdStr as str255)
> dim as str255 tempStr
>
> open "unix", 2, cmdStr
> do
> line input #2, tempStr
> until eof (2)
> close  2
>
> end fn  = tempStr   // where temp string contains how many bytes  
> were uploaded
>
> Brian S.
>
>
> On Nov 22, 2006, at 5:51 PM, Douglas Stemen wrote:
>
>> Brian,
>>
>> This is the code I am using to upload to a specific password  
>> protected area on our server. The original basis for this example  
>> came from Tedd Sperling who sent an excellent  curl demo program  
>> (which should be included in the Staz's examples folder in the  
>> future).
>>
>> This example uploads text file a.txt to appends it to text file b.txt
>>
>> If you do not want to append file b.txt then eliminate the -a  
>> option. Without the -a option the file at the destination is  
>> overwritten.
>>
>> If you do not want to change the name of file a.txt to b.txt then  
>> eliminate then b.txt in the url
>>
>> An issue I am trying to resolve is that with uploading or  
>> downloading I just want to receive a message if there is an error.  
>> In this example the container gC always gets server information  
>> that I don't care about. Likewise with RP's example I am studying  
>> now. With a download there is much useless data, I only want to  
>> know if/why the transmission failed so I can alert the user. I  
>> suppose I have to read each LINE INPUT 2 to see if it starts with  
>> "curl:(--)" which probably means there is an error.
>>
>> fileStr = "~/Desktop/a.txt"
>> etxt = " --quote -quit 2>&1"
>> url=" ftp://216.201.0.202/b.txt"
>> cmdStr = "curl -T " + fileStr + " -a "+" -u "+userStr +":" + pwStr  
>> + url + etxt
>>
>> open "UNIX", 2, cmdStr
>>
>> DO
>> line input #2, strTemp
>> gC += strTemp + chr$(13)
>> UNTIL EOF (2)
>> CLOSE  2
>>
>>
>>
>>
>> On Nov 22, 2006, at 7:05 PM, Brian Stevens wrote:
>>
>>>
>>> On Nov 22, 2006, at 4:06 PM, Brian Stevens who came home tired  
>>> stupidly wrote:
>>>
>>>> Doug - would you post the code that loads user string and  
>>>> password string?  Thanks.....Brian S.
>>>
>>> Nevermind for the user and password  but I would be interested in  
>>> how the upload is directed at a specific directory.
>>>
>>> Thank you.
>>>
>>> Brian S.
>>>
>>> --
>>> To unsubscribe, send ANY message to: futurebasic- 
>>> unsubscribe@...
>>>
>>
>> --
>> To unsubscribe, send ANY message to: futurebasic- 
>> unsubscribe@...
>>
>
> --
> To unsubscribe, send ANY message to: futurebasic- 
> unsubscribe@...
>