Perhaps I am misreading this code or this entire thread but you appear to be using the stor method
stor ( FILE )
Tell the server that you wish to store a file. "FILE" is th
+e name of the new file that should be created.
Perhaps you should try the put method ?
put ( LOCAL_FILE [, REMOTE_FILE ] )
Put a file on the remote server. "LOCAL_FILE" may be a name
+ or a filehandle. If "LOCAL_FILE" is a filehandle then "REMOTE_FILE"
+ must be specified. If
"REMOTE_FILE" is not specified then the file will be stored
+ in the current directory with the same leafname as "LOCAL_FILE".
Returns "REMOTE_FILE", or the generated remote filename if
+"REMOTE_FILE" is not given.
NOTE: If for some reason the transfer does not complete and
+ an error is returned then the contents that had been transfered will
+ not be remove automat‐
ically.