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

  • Home
  • SEARCH
  • 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 6179127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:35:55+00:00 2026-05-24T00:35:55+00:00

When I trying to upload a file with php and curl, an error occurs

  • 0

When I trying to upload a file with php and curl, an error occurs “failed creating formpost data”. I know that error occur when file path incorrect

test.php
...
$postcontent['files'] = '@test.jpg';
...

test.php and test.jpg in the same folder. But if I change path to physic path, code run well

test.php
...
$postcontent['files'] = '@F:\xampp\htdocs\upload\test.jpg';
...
  • 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-24T00:35:56+00:00Added an answer on May 24, 2026 at 12:35 am

    Try to always use an absolute path, like you did in your second example, which works.

    Of course, you do not want to hard-code that physical path, so you will want to use either :

    • dirname(__FILE__) to get the path to the directory that contains the file in which this is written
    • Or, with PHP >= 5.3 : __DIR__ which gives exactly the same path.

    So, in your case, you’d probably use something like :

    $postcontent['files'] = '@' . __DIR__ . '/test.jpg';
    

    Or, with PHP < 5.3 :

    $postcontent['files'] = '@' . dirname(__FILE__) . '/test.jpg';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write some PHP to upload a file to a folder on
I am trying to upload a file or stream of data to our web
I'm trying to upload a picture to a specific website using php cURL but
I am trying to upload file using php. I am using the function move_uploaded_file.
friends, i am trying to upload file to php server using following tutorial http://getablogger.blogspot.com/2008/01/android-how-to-post-file-to-php-server.html
I am trying to upload a file using php,and i need to pass a
I am trying to upload file to FTP server using php but it is
I am trying to upload a file of 1GB size using php script and
I trying to use PHP's file upload abilities, but when I try to upload
I'm trying to upload a file using PHP. My HTML page with the form

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.