Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6039615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:23:43+00:00 2026-05-23T06:23:43+00:00

I need to upload directories to a FTP server on my application, and plan

  • 0

I need to upload directories to a FTP server on my application, and plan to
use libcurl. I see there is no direct way to upload a directory with many
files, which makes sense to me. I couldn’t, however, find any mention on
uploading many files.

If I get the list of files in the directory, I could upload them in a loop.
The option CURLOPT_FTP_CREATE_MISSING_DIRS might help with sub-directories,
but if I’d like to know also if I’m missing the point here or this would have
any serious drawback.

The main question is: how can I keep the connection “open”? Reconnecting on
each file would probably mean an extra unwanted overhead.

Ideally, I’d like to keep using the easy interface. But if another interface
provides better support in this case, I’ll use it.

CURLcode ret;
CURL *handle = curl_easy_init();

/* Connect to FTP server using     *
 * the given username and password */

for ({each file}) {

    curl_easy_setopt(handle, ..., ...);
    ...
    ret = curl_easy_perform(handle);
    /* Analyse return code */
    curl_easy_reset(handle);
}

/* Disconnect from server */
curl_easy_clenup(handle);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:23:44+00:00Added an answer on May 23, 2026 at 6:23 am

    Just re-use the same handle, and it will keep the connection open as much as possible and subsequent transfers will re-use the previous one.

    When you use the easy interface, the connection cache is kept within the easy handle. If you instead use the multi interface, the connection cache will be kept within the multi handle and will be shared among all the easy handles that are used within the same multi handle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to upload a directory having sub-directories to a ftp server. I can
Need to upload and download files to and from a FTP server Synchronously using
I'm using FTPClient (org.​apache.​commons.​net.​ftp.​FTPClient) to upload some files to a FTP server. I need
I need to upload a bunch of files in a directory to S3. Since
I need to upload an image to a remote PHP server which expects the
I need to upload a csv file to a server. works fine for smaller
I have the following problem. I need to organize automatic upload to deploy server
I need to upload image to the server, where SmartGWT webapplication is running... after
I need to upload a pic on server without using html form tag. Is
I need to upload images using FileUpload without postback(using Ajax).I tried many examples.But in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.