This is a bit complicated, I'm just hoping someone else has run into this and knows how to do it a different way or make it work.
When sending a file as part of form information included in a cURL request, it appears you can not include a query string in the file name. Take a look at my example to see what I'm talking about.
Code: //This creates an example image with some text from $_GET['img'] you can try calling this directly to see what the output looks like
if(isset($_GET['img'])){
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 255, 255, 255);
imagestring($im, 3, 3, 3, $_GET['img'], $text_color);
header('Content-type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
exit;
}
//Show what was sent to the $_POST and $_FILES variables
if(isset($_POST['showpost'])){
echo '<pre>';
print_r($_POST);
print_r($_FILES);
exit;
}
//Here's the part where we get in trouble...
//This works
//$imgURL = '@'.$_SERVER['SCRIPT_FILENAME'];
//This doesn't work
$imgURL = '@'.$_SERVER['SCRIPT_FILENAME'].'?img=true';
$data = array('showpost' => 'true', 'file' => $imgURL);
//Now do the cURL request to show information about the file that was sent
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);
if(curl_errno($ch))
echo curl_error($ch);
curl_close($ch);
When using the section that says "This doesn't work" you'll get the cURL error "failed creating formpost data".
Any suggestions?
ME54/ME54N Conditional check for Release of PR
Hi Gurus,
chat
hello i'm amir
How a counter of users ? such as ---> (231 Viewing)
I want to count how many users are actually viewing the page, How is that possible?Thank you guys!
Local file browser with php
Halo..So this is what i want to create. I have a folder that i share and it has many movies..So i will setup a local web browser and i want to make a .php file that after you login it will saw you the
Undefined variable when using $_SERVER['PHP_SELF']
Hi guyz, please suggest me something...On first.php I have one input field NAME, and on posting the form it moves to "second.php" showing the entered value of input field using $_POST,
help me fix these syntax errors...
I keep getting multiple syntax errors on this script like this one:Parse error: syntax error, unexpected T_ELSE in .../scripts/php/loginform2.php on line 40when I change that line I get another on
gather checkbox data from form into email
Hello all,First, i'd like to thank everyone who responded to my previous posts regarding setting up an SMTP server for my php form. I ended up figuring it out and my form is up and functioning,
Do While statement
hi guys,This may sound trivial but im new to php and as part of an assignmenti have to construct the 10 green bottles song using the do while statement. I can do the statement but it is itengrating
MS Access data into a html table
Hi everyone, I am quite a novice at php but I have created some helpful scripts that fetch datafrom a ms access database that is used by our POS program at work ( a spa/salon)My boss asked me to
Selecting an "empty" date formated field
How do you select an "empty" date field? I've tried the few ways I can think.