Hi All,
I'm uploading from https site to a remote https site.
I'm having trouble using method POST multipart/form-data as firefox sees this unencrypted post data and aborts the operation.
I was thinking of using curl (details below) but i get "undefined index : file in upload.php. (as these super(or automatic) globals arn't passed.
In the fetch1.php below, i'm attempting to post variables and recreate these globals on the new server.
I cannot get it to register the global variables
upload form -> fetch1.php(on same server) -> upload.php (remote ssl)
fetch1.php
Code:
<?php
// include_once('file://///Mainxp/shareddocs/psd.php');
header('Expires: Tue, 08 Oct 1991 00:00:00 GMT');
header('Cache-Control: no-cache, must-revalidate');
// set to remote script to call
$remote = 'https://example.com.au/upload.php';
$remote .= '?job_id=' . $_GET['job_id'];
$basename = basename($_FILES['file']['name']);
$remote .= '&basename=' . $basename;
$ch = curl_init();
//curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_URL, $remote);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/gd_bundle.crt");
curl_exec($ch);
curl_close($ch);
?>
then upload.php tries to extract post variables and create globals
Code:
<?php
global($_FILES['file']['name']) =$_GET['basename'];
if($_FILES['file']['error'] == UPLOAD_ERR_OK){
$path = '/var/www/html/uploads/'; //destination upload directory
$path .= basename($_FILES['file']['name']); //concats new path to base file name (pulled from $_files array
if(move_uploaded_file($_FILES['file']['tmp_name'], $path)){
//upload successful
}
}
?>
any help would be greatly appreciated.. thanks