Jump to content

light893

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

light893's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I was able to solve the problem in case it may help anyone else. I was referencing the location incorrectly. In the file sending, it should be: [pre]$file = "D:\htdocs\scripts\curlTest\send2.php"; $postData['uploaded'] = "@$file"; $postData['submit'] = "UPLOAD"; $postData['max_file_size'] = "300000";[/pre] and in the file receiving the call, it should be: [pre]$target = "upload\\"; $target = $target . basename( $_FILES['uploaded']['name']) ;[/pre]
  2. Hello, I've been banging my head on this for the past day. I have looked in the php docs and found the example below which I copied. I tried on 2 different servers and I get the error: "failed creating formpost data". So it seems to be erroring before the information is even sent via curl. I have the file "dog.txt" in the same directory as my php script initiating the send. There seems to be something that I am just missing and can't figure it out. Any advice would be appreciated. I have tried on my local machine using Apache and on my remote server using Windows IIS with the same error. [pre]<?php $postData = array(); $postData['uploaded'] = "@dog.txt"; $postData['submit'] = "UPLOAD"; $postData['max_file_size'] = "300000"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://www.mydomain.com/scripts/curlTest/upload.php" ); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult = curl_exec($ch); if (curl_errno($ch)) { print curl_error($ch); } curl_close($ch); print "$postResult"; ?>[/pre]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.