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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:42:25+00:00 2026-05-27T10:42:25+00:00

Is it possible to provide HTTP multipart response just like multipart request? The scenario

  • 0

Is it possible to provide HTTP multipart response just like multipart request? The scenario is like, I would like to provide a URL which takes a parameter for EmployeeID, and in return the response should consist of employee’s photo, latest payslip and information like name, age and address. The receiving end is not a browser, but it will be a program which gets this response and process them later. Any idea on how to do this?

To give more information on my above question, I have to provide a URL to my friend who will programmatically receive the response. For e.g.:

$response = $ua->request($my_url)

My application is supposed to respond with not just data, but also with files! I was being asked to make it to return multipart response.

  • 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-27T10:42:25+00:00Added an answer on May 27, 2026 at 10:42 am

    I’m posing my original https://gist.github.com/1391017 as response.

    #!/usr/bin/perl
    use strict;
    use warnings;
    
    use HTTP::Response;
    
    my $response = HTTP::Response->new(
        200, 'OK', [ 'Content-Type' => 'multipart/form-data' ]
    );
    
    $response->protocol('HTTP/1.1');
    $response->date(time);
    $response->server('Foo/1.0');
    
    my $name = HTTP::Message->new([
        'Content-Type'        => 'text/plain; charset=UTF-8',
        'Content-Disposition' => 'form-data; name="name"',
    ], 'John Doe');
    
    $response->add_part($name);
    
    my $note = HTTP::Message->new([
        'Content-Type'        => 'text/plain; charset=UTF-8',
        'Content-Disposition' => 'form-data; name="note"',
    ], <<'NOTE');
    Resources:
      o http://search.cpan.org/dist/HTTP-Message/lib/HTTP/Message.pm
      o http://search.cpan.org/dist/HTTP-Message/lib/HTTP/Response.pm
      o http://tools.ietf.org/html/rfc2388
      o http://tools.ietf.org/html/rfc2616
    NOTE
    
    $response->add_part($note);
    
    my $blob = HTTP::Message->new([
        'Content-Type'        => 'application/octet-stream',
        'Content-Disposition' => 'form-data; name="blob"; filename="blob.bin"',
    ]);
    $blob->add_content('a chunk');
    $blob->add_content(' of data');
    
    $response->add_part($blob);
    
    print $response->as_string;
    

    Output:

    HTTP/1.1 200 OK
    Date: Thu, 24 Nov 2011 10:03:25 GMT
    Server: Foo/1.0
    Content-Type: multipart/form-data; boundary=xYzZY
    
    --xYzZY
    Content-Type: text/plain; charset=UTF-8
    Content-Disposition: form-data; name="name"
    
    John Doe
    --xYzZY
    Content-Type: text/plain; charset=UTF-8
    Content-Disposition: form-data; name="note"
    
    Resources:
      o http://search.cpan.org/dist/HTTP-Message/lib/HTTP/Message.pm
      o http://search.cpan.org/dist/HTTP-Message/lib/HTTP/Response.pm
      o http://tools.ietf.org/html/rfc2388
      o http://tools.ietf.org/html/rfc2616
    
    --xYzZY
    Content-Type: application/octet-stream
    Content-Disposition: form-data; name="blob"; filename="blob.bin"
    
    a chunk of data
    --xYzZY--
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Why does C# not provide the C++ style ‘friend’ keyword? I'd like
Is it possible to create a Silverlight application which can be used to provide
Is it possible to provide version information to go with an HTTP cookie? I
According to this sample: http://www.codeproject.com/KB/mobile/DeepCast.aspx It's possible to request a gps coordinate (longitude &
I need to provide a static url to a client, eg. http://domain.com/video.mp4 . However
Using this method Assembly.Load(Byte(), Byte()) http://msdn.microsoft.com/en-us/library/twt16z2x.aspx It is possible to provide a byte representation
Possible Duplicate: How to simulate browser HTTP POST request and capture result in C#
Consider the following XML: <response> <status_code>200</status_code> <status_txt>OK</status_txt> <data> <url>http://bit.ly/b47LVi</url> <hash>b47LVi</hash> <global_hash>9EJa3m</global_hash> <long_url>http://www.tumblr.com/docs/en/api#api_write</long_url> <new_hash>0</new_hash> </data>
I would like to support HTTP Basic Authentication in my UIWebView. At the moment,
We have an application which would involve HTTP live streaming. As per the documentation,

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.