Skip to main content
Participating Frequently
May 18, 2023
Question

Get active FTP connection in Coldfusion

  • May 18, 2023
  • 2 replies
  • 607 views

Hi,

I am trying to upload large file 3-5 Gb to the ftp server and when i upload more then 2 larger files in parallel it stops the CF server, is there a way to see the number of active FTP connection so that i can restrict the user to not upload more then 2 files in parallel.

Thanks in advance everyone.

    This topic has been closed for replies.

    2 replies

    Community Expert
    May 18, 2023

    Can you provide some additional information on what you're doing, along with your version number etc that @BKBK asked for? My feeling is that you're really overworking the CFFTP tag, if that's what you're using. I'd try to extract the FTP functionality from your CF app, so that CF is responsible for putting files in a given directory, then you're using your own command-line script that tracks the files currently being FTPd, and that script uses a command-line FTP client to actually move the files. I'm a little hazy on how you'd track the files being moved, but am fairly confident it's doable.

     

    Dave Watts, Eidolon LLC

    Dave Watts, Eidolon LLC
    Participating Frequently
    May 19, 2023

    Hi Dave,

    Server ProductColdFusion 2016
    Version2016.0.03.300466

    This is code that i am using currently:

    <cfset variables.uploadedFileServerName = "TestUploadFile" & "/" & "#fileName#" />
    <!---<cfset fileName =  uploadResult.serverfile/>--->
     
    <cfftp connection="session.ftpConn"
    action="open"
    server="uploaduat.flexnetoperations.com"
    username="someusername"
    password="somepassword"
    stoponerror="Yes"
    timeout="90000">
    Did it open connection? <cfoutput>#cfftp.succeeded#</cfoutput><br />
    <cfif cfftp.succeeded>
     
    <cfftp connection = "session.ftpConn"
    action = "PutFile"
    localFile="#form.FileContents#"
    remoteFile="#variables.uploadedFileServerName#"
    stoponerror="Yes"
    passive = "Yes"
    timeout="90000">
    <P>Did it succeed? <CFOUTPUT>#CFFTP.Succeeded#</CFOUTPUT>
    <cfif CFFTP.Succeeded>
    <P>Close the connection:
    <CFFTP ACTION="close"
    CONNECTION="session.ftpConn"
    STOPONERROR="Yes">
    <P>Did it succeed? <CFOUTPUT>#CFFTP.Succeeded#</CFOUTPUT>
    <cfset form.FileContents = ""/>
    <cfset fileId = URL.fileId/>
    <script type="text/javascript" language="JavaScript">
        <cfoutput>
    Maximum number of POST request parameters  
    Maximum number of parameters in a POST request sent to the server. ColdFusion rejects requests if the POST parameters exceed the limit you specify.

    Maximum size of post data   MB
    Limits the amount of data that can be posted to the server in a single request. ColdFusion rejects requests larger than the specified limit.

    Request Throttle Threshold   MB
    Requests smaller than the specified limit are not handled by the throttle.

    Request Throttle Memory   MB
    So, when i upload more than 2-3 large files around 3-5GB it hangs and stops the coldfusion server, so i want if there is a way to see i there are two ftp connections are opened or two active requests then user does not upload the third file. what could be the possible solution.
    Thank you so much for help in advance.
    BKBK
    Community Expert
    Community Expert
    May 18, 2023

    What is your ColdFusion version and update level? Generally, the settings for maximum number of request threads and maximum size of post data can be found in the Server Settings page in the ColdFusion Administrator. You should test by changing the settings.

     

    Do you want a fine-grained view of the connections? Then you should monitor your application with FusionReactor or with Adobe's own Performance Monitoring Toolset.