jquery - Move Upload File from PHP to CGI -



jquery - Move Upload File from PHP to CGI -

im trying pass post file info upload.php file , have info sent cgi script. there nil on net on how go doing can find, iv spent days. know there few people out there need this, help have legacy perl scripts.

dataflow: jquery --> upload.php --> index.cgi

my php:

<?php if(isset($_files['file'])) { if(move_uploaded_file($_files['file']['tmp_name'], "../index.cgi" . $_files['file']['name'])){ echo "success"; exit; } } ?>

post phone call cgi example:

foobar.com/index.cgi?act=store&data=$filename

any suggestions help greatly. give thanks you.

from understanding, cgi script receiving parameter path of uploaded script. attempting pass uploaded script cgi script using function supposed move file 1 place without executing script. suggestion following

<?php if(isset($_files['file'])) { $destination = "new/path/to/".$_files['file']['name']; if(move_uploaded_file($_files['file']['tmp_name'], $destination)){ $data = array(); //you can add together multiple post parameters here //$data = array('param1' => 'value1', 'param2' => 'value2'); $url = "http://url/to/hello.cgi"; // can post file prefixing @ (for <input type="file"> fields) $data['file'] = '@'.$destination; $handle = curl_init($url); curl_setopt($handle, curlopt_post, true); curl_setopt($handle, curlopt_postfields, $data); $result = curl_exec($handle); if($result) { echo "success"; } exit; } } ?>

you can execute cgi script via curl post , pass params want

php jquery

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -