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 8705925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:29:07+00:00 2026-06-13T03:29:07+00:00

I am using a library from http://fastcgi.com/ in C++ application as a backend and

  • 0

I am using a library from http://fastcgi.com/ in C++ application as a backend and nginx web-server as a front-end.

Posting files from HTML-form successfully and can see the temporary files on nginx server side. But I can’t figure out how to access a body of multipart POST request using fastcgi_stdio. This is my HTML-form.

<html>
    <head>
        <title>Test Server</title>
        <script src="http://code.jquery.com/jquery.min.js"></script>
    </head>
    <body>
        <form id="upload-form" method="post" target="upload_target"   enctype="multipart/form-data" action="/upload">
            <input name="file" id="file" size="27" type="file" /><br />
            <input type="submit" name="action" value="Upload" /><br />
            <iframe id="upload_target" name="upload_target" src="" style="width:100%;height:100px;border:0px solid #fff;"></iframe>
        </form>
    </body>
</html>

My nginx conf file:

location /upload {

# Pass altered request body to this location
upload_pass @test;

# Store files to this directory
# The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist
upload_store /www/test;

# Allow uploaded files to be read only by user
upload_store_access user:rw group:r all:r;

# Set specified fields in request body
upload_set_form_field $upload_field_name.name $upload_file_name;
upload_set_form_field $upload_field_name.content_type "$upload_content_type";
upload_set_form_field $upload_field_name.path "$upload_tmp_path";

# Inform backend about hash and size of a file
upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";
upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";

upload_pass_form_field "^submit$|^description$";
upload_cleanup 400 404 499 500-505;
}

include fastcgi.conf;

# Pass altered request body to a backend
location @test {
        fastcgi_pass  localhost:8080
}

Now, how can handle/get the POST request body in my fastcgi c++ application and how to write it in proper file at the fastcgi app side ?

Is there any better fast module to achieve this?

Thank you.

  • 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-06-13T03:29:08+00:00Added an answer on June 13, 2026 at 3:29 am

    You can access the POST body via the FCGI_stdin stream. For example, you can read from it one byte at a time using FCGI_getchar, which is a short form for FCGI_fgetc(FCGI_stdin). You can read larger chunks of data in a single call using FCGI_fread. All of this I found looking at the source. These sources often reference something called ”H&S”—this stands for “Harbison and Steele”, the authors of the book C: A Reference Manual, and the numbers refer to chapters and sections of that book.

    And by the way, it’s called “stdio” for “STanDard Input/Output”. Not “studio”. The functions should mostly behave like their counterparts without FCGI_ prefixed. So for details, look at the man pages of getchar, fread and so on.

    Once you have the bytes in your application, you can write them to file, either using normal stdio operations or files opened via FCGI_fopen. Note however that the input stream will not directly correspond to the content of an uploaded file. Instead, MIME encoding is used to transfer all form data, including files. You’ll have to parse that stream if you want to access the file data.

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

Sidebar

Related Questions

I'm using the AsyncHttpClient library from http://loopj.com/android-async-http/ and have it calling web services fine
Using the p4java library from Perforce (http://kb.perforce.com/article/1086/p4java-api), I'm trying to find out what files
I am using the control library from http://code.google.com/p/gong-wpf-dragdrop/successfully for my listbox dragging operation.But there
I am using http://java.sun.com/jsp/jstl/fmt tag library for outputting messages from Message Resource Bundle which
I am using a CodeIgniter google map library from biostall.com http://biostall.com/codeigniter-google-maps-v3-api-library Every things works
Using the function from: http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged.aspx public static byte[] encryptStringToBytes_AES(string plainText, byte[] Key, byte[] IV)
I am using the powercollections library from http://powercollections.codeplex.com/ The first test passes, however the
i'm trying to download file from http server using WinINet library calls. It works
I am using the Raphael library from http://raphaeljs.com/ and work on a chart library.
I am using the PHP OpenID library from http://openidenabled.com on my site. However, I

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.