Cfftp and cftransaction
I'm trying to use a query into a DB and then use cfftp to
upload a file to my webserver.
Is there a way to roll back the cfftp request if there are
any errors in the process?
Thanks in advance
Once the file has been uploaded to your server, you can
delete it with cffile.
Similar Messages
-
Gentlemen,
I am writing a script to connect o a remote SFTP server. The server that I am trying to login to requires a "private key" which is a file that the remote authentication process uses to log you in. In Winscp I browse to the file that is my key. That is in addition to my host server name, username and password. Using cfftp I can specify the host, the username and the password but I don't know what to do when it comes to this file which is my key: filename.ppk.
Any thoughts anybody?
And I need to pass that file so my connection gets established.
Thanks!
Ysais.Thanks Mack, Now I am trying to extablish a secure FTP connection and my code is complaining about the attribute connection. I am really troubled since I need to specify a connection name to be able to reuse my connection again. This is my code:
<cftry>
<cfftp action="open" connection="VeratadFtpConnection" fingerprint="#variables.fingerprint#" key=\\server\path\key.ppk passphrase="passphrase" secure="no" server="ftp.server.com" stoponerror="no" username="someuser">
<cfcatch type="any">
<cfoutput>
#cfcatch.Message#<br />
#cfcatch.Detail#<br />
#cfcatch.Type#<br />
</cfoutput>
</cfcatch>
</cftry> -
Cfftp and file's lastModifed question
Using cfftp, is there another way to get a file's
LastModified DT stamp other that using action="listDir"?
I have a scheduled job that hits an ftp server every minute.
The file I'm trying to check is in a folder with a handful of files
that are all constantly updating, and my code intermittently bails
on the "listDIr". My guess is one of the files are being updated at
the moment I'm doing a "listDir", and ColdFusion can't read the
directory and bails.
Thanks for reading,
JBUsing cfftp, is there another way to get a file's LastModified
DT stamp other that using action="listDir"?...The problem is
listDir does more than I need (i.e., gets meta data for everything
in the ftp directory). I just need the modifed DT stamp for one
file. But I can't figure out any other way to get it than to list
the whole directory and parse through that.
I, too, might need such a functionality. Here is something I
found. Download the
free
version of edtFTPj. It is a ZIP file. Extract it. Copy the JAR
file, edtftpj-1.5.2.JAR, to Coldfusion's lib directory (e.g.
c:\cfusionmx7\lib on my machine). Restart Coldfusion, to update it
with the new JAR file.
The code below assumes the following:
FTP server: ftp.juliebread.com
username: BKBK
password: kbkb072
File whose 'last modified date' you need:
ftp://ftp.juliebread.com/testdir1/testdir2/report.xml
For more information, go to the
edtFTPj
website. There you will find information about
the
edtftpj API and, in particular, about the
FTPClient
class. -
CFFTP, CFLDAP and securing passwords
Good afternoon. I have several applications which use tags
such as CFFTP and CFLDAP. These applications do not prompt for user
input, but rather automatically supply the application with the
username and password required from a DB lookup. Currently, the
passwords are stored in plain text in the DB (SQL 2K)...yes, I
know...HORRIBLE!!! How do I secure these passwords or at least
secure passing the passwords to the tags, so that they are not in
plain text? Since I am automatically supplying these passwords, I
can't use salting and hashing, right? Your expedient assistance is
greatly appreciated. Thank you.
ChrisHi Chris,
You should really be storing your passwords with a one-way
hash in your database but that won't help with the SFTP problem. If
you are using SFTP the passwords are not sent to the server in
plain text anyway, the only difference is that you are giving it
over to the sftp tag from a query column, which is in plain text
anyway. If I understand correctly you would want to retrieve the
usernam and password from the database, encrypt the password, pass
the username, password and encryption key to a function that would
then unencrypt the password and pass it to the SFTP tag? You have
to give an unencrypted password to the tag since I imagine the
password on the server is also not encrypted.
That seems like a lot of overhead for absolutely no increase
in security. -
Hi,
I have a page which uses CFFTP and Ajax to allow the user to browse an FTP directory list.
The logic is,
Open Connection and List FTP Folders in Root, Close connection
Click Folder
Open Connection and List FTP Folders in Folder clicked, Close Connection
Click File
Copies File to hardcoded location.
Here's is a snippet of code
<cfparam name="arguments.dir" default="">
<!--- Open FTP Connection --->
<cfftp connection="Myftp"
server="server"
username="username"
password="password"
action="Open"
stoponerror="Yes"
passive="yes"
>
<cfif NOT comparenocase(arguments.dir, '')>
<!--- Get Curent FTP Directory --->
<cfftp connection="Myftp"
action="GetCurrentDir"
stoponerror="Yes"
passive="yes">
<cfset arguments.dir = cfftp.ReturnValue>
</cfif>
<!--- Get Directory Listing --->
<cfftp connection="Myftp"
action="listdir"
directory="#arguments.dir#"
name="dirlist"
stoponerror="Yes"
passive="yes"
>
<!--- Close FTP Connection --->
<cfftp action="close" connection="Myftp" passive="yes">
This can work fine, but more often than not it hangs. When it hangs I cannot access the FTP server via an FTP client either.
Any ideas? ThanksPotential issues that I'm thinking it could be are:
- TransactionScope Promotion
- MSDTC Problems
- ODP.NET issues with MTS -
How to save an image from an HTTP adress
I want to save to my HardDisk an image which adress is for
example :
http://www.mysite.com/img/myimage.jpg
I cannot use CFFTP, and CFFILE does not allow HTTP adress,
It should be something like CFFILE but on HTTP protocole ?
Thanks for any help,
Pierre.plarts wrote:
> CFHTTP allow me to get the HTTP file and display the
image on my screen,
> but cannot save it on the HardDisk.
Yes, it can. Did you look at the documentation as suggested.
Specifically the file and path attributes?
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_g-h_09.html -
Connect To FTP://
I am having some issues here with connecting to a ftp://
site...
How do I connect to this address ftp://idx.fnismls.com with a
username and password. I have tried cfhttp and cfftp and it fails
with both. This address only works in a brower if you type in the
full address with ftp:// ... if you just type in idx.fnismls.com it
will not ask you for the username and password to get access.
I have no clue as to what to do. Any help would be much
appreciated.
Thanks!here's a sample of what you'd do...
<cfftp action="OPEN" server="ftp://idx.fnismls.com"
username="username"
password="password" result="" stoponerror="Yes" port="21">
what's the exact problem you're having?
any errors/mesages?
"bweno" <[email protected]> wrote in message
news:fg8brh$7q9$[email protected]..
>I am having some issues here with connecting to a ftp://
site...
>
> How do I connect to this address ftp://idx.fnismls.com
with a username and
> password. I have tried cfhttp and cfftp and it fails
with both. This
> address
> only works in a brower if you type in the full address
with ftp:// ... if
> you
> just type in idx.fnismls.com it will not ask you for the
username and
> password
> to get access.
>
> I have no clue as to what to do. Any help would be much
appreciated.
>
> Thanks!
> -
This is the weirdest behavior i've ever seen in 8 years using
CF. My CF 7.0.2/Win2003 AS/Jrun is hanging everyday. Sometimes it
dies 8:10, sometimes 8:20.... sometimes processor % is 50%,
sometimes is 0%. It's impossible to restart only CF, we need to
reboot the machine. I put the simultaneous requests to 64,
sometimes it hangs using 32, sometimes 63, sometimes 64.
Perfmon
Shot 1 - Hangin at 27 running requests, Simul. set to 48, no
queues, no timeouts, not a daamn clue.
Perfmon
Shot 2 - today... running requests at 45 (simultaneous to 64
max...??) processor time dropped to zero?
We have timeouts on every CFFTP and CFHTTP, now we're
finishing putting timeouts on every cfquery...
1) We thought it was those damn unresponsive threads, but
nothing is scheduled to run at this particular timeframe.
2) We thought it might me a RAR application compressing
database backup... NOPE, rar was rescheduled to 8:45 and CF died
ate 8:10 this morning..
3) We've been having this everyday...
4) Database is running on a separate server, perfmon is
telling me its running smooth, although it looks like db server
isn't responding...
4) Overall timeout set to 60sec, individual database timeout
30sec. CFHHTP/CFFTP timeouts, 20-30 sec.
I'll be checking for network problems and etc. but there's a
question pending answer: Why da hell CF is going thru the roof in
simultaneous requests and hanging and queue is zero (we had a
1-second 10 queues peak once) and its not timeouting.BKBK, im really sorry for this, i haven't noticed the adult
content... i just found this image hosting site and uploaded the
perfmon shots.. and, it's Alexei my name... and it's not what youre
thinking, this is a damn free image hosting site, im not earning
nothing form it. feel free to update an image there and see how it
works...
Sadikh, i've spotted a schedule ending near hang times, it
consists in a big cfloop with tons of cfhttps inside. thanks for
your reply, got your idea, it seems to be the right approach. Since
I believe I could isolate the problem, now i'll focus on triggering
the weird behavior. -
Any idea for uploading big file ?
i am working on a website , need to upload FLV video file , the problem i have i can upload the files like jpg with the low size like 500K or 1 MB , but when i try to upload movie file with the 2-3 MB after few minute i get internal error 500. its working on my local system nice but when i try from the hosting , its going crazy.
i use <cffile> to upload . i try <cfftp> and try to upload via ftp protocol but its same . it should not be timeout error because when i run it on my local server and change the destination to upload on hosting server insted of my local server its work perfect and upload the 3mb file in less than minute but when i run it on the hosting server nothing .
anybody has an idea whats going on ?
also it there any chance to have progress bar when useing <cffile > or <cfftp> ?
thanksIt is quite likely that a maximum size limit of around 1 MB has been set in the Administrator of the hosting server. Ask the people who run the server about this.
-
<!---Control the timeout--->
<cfsetting requesttimeout="600">
<cfset thisDate = now()>
<cfset today = #DateFormat(thisDate,"mm-dd-yyyy")#>
<!--- Open ftp connection --->
<cfftp connection="MyFtp"
server="#FTPserver#"
username="#username#"
password="#password#"
action="Open"
stoponerror="Yes">
<cfftp action="listdir"
stopOnError="Yes"
name="Files"
directory="/export400"
connection="MyFtp"
>Try removing the quotes from around the connection name in your CFFTP lisdir block. So change the last line to connection=MyFtp instead of connection="MyFtp".
-Carl V. -
Error 550 when using CFFTP to remove a file
I'm using cfftp to download files which I parse, then I need to delete the file from the server. (coldfusion 11 - development)
I can list, and download the files fine, but am butting my head into a problem that I can't seem to resolve.
USING THE SAME PATH AND FILE NAME that allowed me to 'get' the file - When I try to remove the file - I get this error.
Error: 550 file: No such file or directory .
(again - the path and file name I provide are identical to the path/filename -
if this is a permission problem, I can delete files thru Filezilla, using the same credentials - with no problem)
Here is the call to remove -
<cfftp action="remove"
connection="myConnection1"
passive="true"
timeout="360"
remotefile="#myPath##fileName#"
item="file" >I'm not sure where you got the "This is not what the docs say" part. Looking down the list of CFFTP attributes in the CF11 docs that apply to a "remove" operation, those were the attributes I would have expected to need. Although I agree the examples could be clearer and a specific example of removing a file would be useful.
-Carl V. -
I am trying to grab a file and move it to the coldfusion server using <CFFTP> The server in which I am trying to grab the file is a sftp server. I am running coldfusion 8. When I run my code, I dont get an error, I just get a blank white screen, yet the file has not been moved. I will post my code below, does anyone know what I am doing wrong?
<!--- Open conncetion with remote sftpserver --->
<cftry>
<cfftp action="open"
connection="ftpServer"
server="server.com"
username = "username"
password = "password"
fingerprint = "11:11:B5:F2:11:AF:C2:E2:31:11:D3:B4:11:83:11:11"
timeout="20"
port="22"
secure = "yes" />
<cfcatch>
<cfset throwFileTransferFailed("Could not open connection. Message: " & cfcatch.Message & ". Detail: " & cfcatch.Detail)>
</cfcatch>
</cftry>
<!--- get the file --->
<cftry>
<cfftp
action="getFile"
connection="ftpServer"
server="server.com"
username="username"
password="password"
remotefile="TEST_20100816.csv"
localfile="C:\WENS_DEV\pdf\"
failIfExists="no">
<cfcatch>
<cfset throwFileTransferFailed("Could not open connection. Message: " & cfcatch.Message & ". Detail: " & cfcatch.Detail)>
</cfcatch>
</cftry>how do I tellif the CF service has sufficient rights?
Now my code looks like this and I am still getting an error. I cant figure it out.
<cfftp action="open"
connection="ftpServer"
server="server.com"
username = "username"
password = "password"
fingerprint = "11:11:11:11:11:11:11:11:11"
timeout="30"
port="22"
secure = "yes" />
<cfftp
action="getFile"
connection="ftpServer"
remotefile="TEST_20100816.csv"
localfile="C:\WENS_DEV\pdf\TEST_20100816.csv"
failIfExists="no"> -
CFFTP using browse, filename is wrong
I want a user to be able to browse to a file on their local machine then FTP it to a remote server.I've been using CFFTP. I can make the connection to the server just fine. I have the path correct. The problem is when selecting the file through browse, it renames it as a temp file. How can I get the filename on the local computer and the remote server the same?
Since the class is in a package named "test", the Test.class file must be in a directory named "test". And it's this package directory that must be in the classpath. In your case, you should have a directory c:\java\test which contains Test.class.
-
Duplicate Records & CFTRANSACTION
Maybe I'm missing the obvious on this, as I've never had a
problem with this before, but recently I developed a custom tag
that logs and blocks the IP addresses of all these recent DECLARE
SQL injection attempts.
The issue is however that my blocked IP address seems to be
getting duplicates here and there. My "datetime" field in the
database show the duplicates are all added to the database the
exact same second. What gives?
Shouldn't CFTRANSACTION be preventing such a thing, even if
multiple injection attempts come at the same time?I've always coded my applications where my primary key is my
database's autonumber field, and instead insure my coding is solid
enough to prevent duplicate records from appearing. Oddly enough
it's worked flawlessly until now.
Would not ColdFusion throw errors if I made the "ip_address"
field my primary key, and my code allowed for a duplicate record to
be entered? Am I interpretting the CFTRANSACTION code to do
something it doesn't do?
Also, the duplicates aren't causing problems, so a DISTINCT
select isn't necessary. The IP address is blocked whether one
record or fifty exist in my blocked_ip_addresses table. My goal is
just not to waste database space.
Any further help you can provide is MUCH appreciated!
Thanks! -
Hi,
cftransaction is working perfectly when all the insert
updates are called by cfqquery.
But when there is a mysql stored procedure call with in
cftrnsaction and that mysql stored procedure is having many inserts
and updates, cftransaction is not able to roll back insert/updates
happened in stored procedure.
I am using InnoDB tables/database of mysql.
Did anybody faced a similar problem and is it a coldfusion
bug or mysql bug.
We checked with Java and java is able to roll back the
transaction, but coldfusion cftransaction is failing.
Please help.
Regards,
SaikumarMark,
I believe the syntax of your formatted search is not right. I guess you are trying to get the U_Width from Item Master and the other values from the current form.
SELECT @Width = T0.U_WTH FROM [dbo].[OITM] T0.WHERE T0.ItemCode = $[$38.1.0]
EXEC TBC_CHOP @Width, $[$38.U_LINETYPE.0], $[$38.U_LI.0], $[$38.U_LN.0],
$[$38.U_LD.0], $[$38.U_HI.0], $[$38.U_HN.0], $[$38.U_HD.0], $[$38.U_QTYORD.Number]
If you see I have added a third parameter which is the Type to the formatted seach field selection $[$Item.Column.Type]
I have made then all 0 but you may change it as per the col type. This Type should be 0 for Char type columns, Number for numeric columns and Date for Date type cols
Suda
Maybe you are looking for
-
I use iCal, work wants me to sync with Outlook, how do I do this?
Dear Community. I'm happily using iCloud to run my diary across all my Apple devices, how do I get my current setup to sync with Outlook so my office can see my diary? I don't want to change how I make appt's, I can make an appt on my phone, iPad or
-
For over two weeks now I have been frustated and not having my TIme Machine back up to my 1tb external drive. I dont understand why now its a problem. It keeps saying "This backup is too large for the backup disk. The backup requires 345.74GB but on
-
I've linked my new HP printer 8615 to my Mac OS X, and it works for printing. But when I try to scan, the printer tells me it can't locate my computer. But the computer has the printer listed when I go to print. How can I get the printer to recogni
-
Zen Touch freezes even after full recha
I have a 20gb Zen Touch that I have not used for the past few weeks(This is because of my new toy, my 30BG Zen Vision M). Figuring that the battery was discharged or something because of the lack of use, I recharged it fully. I turn it on and it gets
-
After making a new Illustrator file from an old one, then saving it as a pdf, the new Illustrator file reverts back to old one. I have been using the pdf to make the Illustrator file again (luckily I've saved it as editable) but I don't always want t