Latest web development tutorials
×

PHP kuliah

PHP kuliah PHP pengantar singkat PHP memasang PHP tatabahasa PHP variabel PHP echo/print PHP Jenis Data PHP konstan PHP tali PHP operator PHP If...Else PHP Switch PHP susunan PHP Sorting array PHP superglobals PHP While sirkulasi PHP For sirkulasi PHP fungsi PHP Variabel sihir PHP Ruang nama PHP Berorientasi Objek

PHP bentuk

PHP bentuk PHP bentuk Authentication PHP bentuk - bidang yang harus diisi PHP bentuk - email verifikasi dan URL PHP contoh bentuk lengkap PHP $_GET variabel PHP $_POST variabel

PHP canggih Tutorial

PHP Array multidimensi PHP tanggal PHP berisi PHP berkas PHP Upload File PHP Cookie PHP Session PHP E-mail PHP keamanan E-mail PHP Error PHP Exception PHP filter PHP filter lanjutan PHP JSON

PHP 7 Fitur baru

PHP 7 Fitur baru

PHP database

PHP MySQL pengantar singkat PHP MySQL koneksi PHP MySQL Membuat database PHP MySQL Buat tabel data PHP MySQL memasukkan data PHP MySQL Menyisipkan beberapa data yang PHP MySQL Laporan disiapkan PHP MySQL membaca data PHP MySQL WHERE PHP MySQL ORDER BY PHP MySQL UPDATE PHP MySQL DELETE PHP ODBC

PHP XML

XML Expat Parser XML DOM XML SimpleXML

PHP & AJAX

AJAX pengantar singkat AJAX PHP AJAX database AJAX XML AJAX pencarian real-time AJAX RSS Reader AJAX suara

PHP Reference manual

PHP Array PHP Calendar PHP cURL PHP Date PHP Directory PHP Error PHP Filesystem PHP Filter PHP FTP PHP HTTP PHP Libxml PHP Mail PHP Math PHP Misc PHP MySQLi PHP PDO PHP SimpleXML PHP String PHP XML PHP Zip PHP Timezones PHP image Processing PHP RESTful

PHP fungsi curl_file_create

PHP fungsi curl_file_create

Pedoman Kalender Referensi PHP Pedoman PHP Curl Referensi

(PHP 5> = 5.5.0)

curl_file_create - Buat objek CURLFile.


penjelasan

CURLFile curl_file_create ( string $filename [, string $mimetype [, string $postname ]] )

Membuat objek CURLFile, dan meng-upload file.


parameter

nama file

path file upload

mimetype

File mimetype

postname

Nama file.


Kembali Nilai

objek kembali CURLFile.


contoh

curl_file_create () contoh

<?php
/* http://example.com/upload.php:
<?php var_dump($_FILES); ?>
*/

// 创建一个 cURL 句柄
$ch = curl_init('http://example.com/upload.php');

// 创建一个 CURLFile 对象
$cfile = curl_file_create('cats.jpg','image/jpeg','test_name');

// 设置 POST 数据
$data = array('test_file' => $cfile);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

// 执行句柄
curl_exec($ch);
?>

Di atas contoh output akan:

array(1) {
  ["test_file"]=>
  array(5) {
    ["name"]=>
    string(9) "test_name"
    ["type"]=>
    string(10) "image/jpeg"
    ["tmp_name"]=>
    string(14) "/tmp/phpPC9Kbx"
    ["error"]=>
    int(0)
    ["size"]=>
    int(46334)
  }
}

Pedoman Kalender Referensi PHP Pedoman PHP Curl Referensi