› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › Image transfer via fileset-FTP
- Jared Parish
Jared,
Have you tried your output file with a style of Single?
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.
Thanks,
- Jared Parish
If you are using FTP, try bin instead of ASCII transfer protocol. Not sure how to set this up in Cloverleaf. A quick check to see if this is the problem is to look at the file size on Cloverleaf (number of bytes) and compare it to the file size on the destination. If they are not the same, this maybe your problem.
Hope this helps,
Robert Milfajt
Northwestern Medicine
Chicago, IL
If you are doing a raw route and “transferring” between two like systems (which it appears that you are since I don’t see any outbound protocol information) then ASCII vs BINARY is basically a moot point because the difference is whether line termination in an ASCII transfer is done or not. Since two like systems handle line termination the same way both methods will produce the same output. However, if you are transferring between a linux/unix system and a Windows system then the method becomes very important.
Any binary file (image, pdf, etc…) would need to be done using the image/binary method. But it looks like you are doing that, so what is the real problem that you are seeing?
The issues is the images become corrupt when they are FTP’d to the receiving system. In the source thread I have a TCL upoc that writes to the server (for archiving purposes). At this point, I can open the images and they look fine. Once they are FTP’d to the destination they will not open.
Does anyone else use the engine in this manner?
My suggestion to the customer was that the engine really wasn’t designed to be a file transfer service and to find a better suited solutions.
Thank you for all the replies.
- Jared Parish
Robert Milfajt
Northwestern Medicine
Chicago, IL
My $.02 worth
Jim Cobane
Henry Ford Health
We transfer PDFs and JPG images using TCLcurl in the engine. This works quite well.
While the engine was not designed to move images through it, it is quite capable of doing that. If the data is raw routed then there should be no issue with sending it via binary ftp. One thing that may be a problem is if you are sending it and it is being picked up before the FTP is complete. If that is the case, or a possibility, then you need to send it using a temporary file name and rename it when it gets there. The other option is to use TCLcurl on the data which will give you more control over the FTP.
Here is the code that we use to send images via TCLcurl. It is designed to pick up the file and send it out using a filename that rides along with the message, but that is just because this is what our needs were, it could also take the data in a message and send it.
You can see that we set up the information that TCLcurl needs as arguments to the proc. If you decide to use this method and you want to act on the message content (assuming it is an image) you would need to first open up a file, use fconfigure on that file to ensure that it was written back out properly, and then use that as what we have as “binname” here.
######################################################################
# Name: ftpBINfileVPN
# Purpose:
# UPoC type: tps
# Args: tps keyedlist containing the following keys:
# MODE run mode (”start”, “run” or “time”)
# MSGID message handle
# ARGS user-supplied arguments:
#
#
# Returns: tps disposition list:
#
#
proc ftpBINfileVPN { args } {
package require TclCurl
keylget args MODE mode ;# Fetch mode
set dispList {} ;# Nothing to return
switch -exact — $mode {
start {
# Perform special init functions
# N.B.: there may or may not be a MSGID key in args
}
run {
# ‘run’ mode always has a MSGID; fetch and process it
keylget args MSGID mh
keylget args ARGS.URL url
keylget args ARGS.USERPASSWORD userpassword
set userdata [ msgmetaget $mh USERDATA ]
keylget userdata BINNAME binname
keylget userdata FTPOBDIR ftpobdir
if { [ catch { keylget userdata SENDPDF } ] } {
set sendpdf 1
} else {
keylget userdata SENDPDF sendpdf
}
if { !$sendpdf } {
return “{CONTINUE $mh}”
}
if { [ info exists ftpobdir ] } {
set url “$url/../$ftpobdir”
}
set binname [ file tail $binname ]
set ext [ string trimleft [ file extension $binname ] “.” ]
set lookupExt [ string tolower $ext ]
set directory [tbllookup -side input DataFileLocation.tbl $lookupExt]
set ch [ curl::init ]
$ch configure -verbose 1
$ch configure -upload 1
$ch configure -userpwd $userpassword
set outfile $binname
set filename $directory$binname
puts “ftp://$url/$outfile”
$ch configure -url ftp://$url/$outfile
$ch configure -infile $filename
set retryLimit 3
set retry 0
while { $retry < $retryLimit } {
incr retry
if { [ catch { $ch perform } status ] } {
echo "ftp error:$status"
if { $retry == 3 } {
return "{ERROR $mh}"
}
} else {
break
}
}
$ch cleanup
lappend dispList "CONTINUE $mh"
}
time {
# Timer-based processing
# N.B.: there may or may not be a MSGID key in args
}
shutdown {
# Doing some clean-up work
}
}
return $dispList
}
Hope that helps.