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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:55:15+00:00 2026-06-04T17:55:15+00:00

I’m making a call to an external service using the Zend Http client. The

  • 0

I’m making a call to an external service using the Zend Http client. The service allows me to upload files to their storage system. It requires relevant params (userid, etc.) to be sent in the query string, and the file upload content should be sent in the POST body with a content-type of “application/zip” (I’m sending it a zip file with various things in it).

To do this, I set the params in the query string using the zend client’s setParameterGet() function. I then set the file upload content using the setFileUpload() function:

$this->client->setFileUpload($zipFilePath, 'content', null, 'application/zip');

However, the service is telling me that I’m sending it the wrong content type, which is “multipart/form-data”

Here are the raw headers that the Zend client is sending to the service (note that I’ve removed bits of sensitive information, replacing them with item names enclosed in [] brackets)

POST
https://[ServiceURL]?cmd=%5BCOMMAND%5D&enrollmentid=%5BENROLLMENTID%5D&itemid=%5BITEMID%5D

HTTP/1.1

Host: [HOST] Accept-encoding: gzip, deflate

User-Agent: Zend_Http_Client Cookie:

AZT=9cMFAIBgG-eM1K|Bw7Qxlw7pBuPJwm0PCHryD;

Content-Type: multipart/form-data; boundary=—ZENDHTTPCLIENT-05535ba63b5130ab41d9c75859f678d8

Content-Length: 2967

—–ZENDHTTPCLIENT-05535ba63b5130ab41d9c75859f678d8

Content-Disposition: form-data; name=”content”;
filename=”agilixContent.zip”

Content-Type: application/zip

[RAW FILE DATA HERE]

So basically, even though I’ve set the POST content type header, my external service is telling me I’ve sent the wrong content type, because there is another content-type header with the value “multipart/form-data”. I’ve tried changing/removing that content header, but to no avail. How can I remove that header so that I won’t have these two duplicate “content-type” headers in my requests?

  • 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-04T17:55:17+00:00Added an answer on June 4, 2026 at 5:55 pm

    If you want to upload a file using “application/zip” as content type you should not use ->setFileUpload() but rather ->setRawData(). setFileUpload() is used to mimick HTML form based file uploads which is not what you need.

    See http://framework.zend.com/manual/en/zend.http.client.advanced.html#zend.http.client.raw_post_data for more information. What you need (based on your original example) will be something like:

    $zipFileData = file_get_contents($zipFilePath);
    $this->client->setRawData($zipFileData, 'application/zip');
    $response = $this->client->request('POST');
    

    Note that if your ZIP file may be very big (say more than a few megabytes) you may want to use ZHC’s streaming support features, so avoid memory hogging. If you know your files are always less than 5-10 megabytes, I wouldn’t bother with it though.

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

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.