Form for file upload:
<form method="post" action="" enctype="multipart/form-data">
<input name="file" type="file" /> <br />
<input name="submit" type="submit" value="Upload" />
</form>
PHP Code:
<?php
$temp = $_FILES['file']['tmp_name'];
$name = $_FILES['file']['name'];
$post = array (
'file' => '@'. $temp);
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
$exec = curl_exec ($ch);
curl_close ($ch);
?>
No comments:
Post a Comment