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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:48:21+00:00 2026-06-01T18:48:21+00:00

I am using PHP (WAMPServer) to receive a form submission, and then CURL to

  • 0

I am using PHP (WAMPServer) to receive a form submission, and then CURL to pass the file to another server for processing.

Here is an example to illustrate (not the actual code):

$data = array(
  'file' => '@'.$_FILES['key']['tmp_name']
);

Here’s what I’m using for CURL… and as I was pasting the code I noticed that I still have http_build_query() in my code… so, that must be the problem.

$CURL = curl_init();
curl_setopt($CURL, CURLOPT_URL, $operation['callback']);
$query_string = http_build_query($arguments);
curl_setopt($CURL, CURLOPT_POSTFIELDS, $query_string);
curl_setopt($CURL, CURLOPT_POST, TRUE);
curl_setopt($CURL, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($CURL);
curl_close($CURL);
return $result;

My problem is that the last server isn’t receiving the file. Instead, the data is passed as a key-value pair.

$_POST contains 'file' => '@c:\wamp\tmp\xyz.tmp'

What I would prefer, is that the files was transferred, and $_FILES has information about it.

  • 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-01T18:48:22+00:00Added an answer on June 1, 2026 at 6:48 pm

    Don’t build an http query for the CURLOPT_POSTFIELDS. Curl can directly accept an array of fields and do its own encoding/mangling.

    By building your own query, you’re ‘hiding’ the @ that indicates a file upload and CURL will not trigger its upload mechanisms.

    In other words, this will fix things:

    $data = array(
      'file' => '@'.$_FILES['key']['tmp_name']
    );
    curl_setopt($CURL, CURLOPT_POSTFIELDS, $data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using wamp server. And I use dreamweaver to create php files. Here is
i am using php 5.2.4 with wampserver. everything is going fine. i have done
On Windows using WAMPserver (Apache, MySQL, PHP) I have the following: //test.php if (!defined('LC_MESSAGES'))
I want to send messages to mobile phones using wamp server in php.I need
Using PHP, it's possible to read off the contents of a file using fopen
I have installed PHP using wamp server in Windows and I have give the
Im using wamp server for my php scripts. And Im having difficulties on the
When using the get_browser function in PHP on: Linux server - works perfectly. WAMP
I have a 3 file: class.database.php config.php test.php In class.database.php i using: <?php class
I want to bake cake php project on Windows system. I'm using wamp server

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.