mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Documentation for curl_file_create
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@330516 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
e7bbcdc9f5
commit
995444f050
1 changed files with 67 additions and 8 deletions
|
@ -4,7 +4,7 @@
|
|||
<refentry xml:id="function.curl-file-create" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>curl_file_create</refname>
|
||||
<refpurpose>Create the CURLFile object</refpurpose>
|
||||
<refpurpose>Create a CURLFile object</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
|
@ -16,11 +16,9 @@
|
|||
<methodparam choice="opt"><type>string</type><parameter>postname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
||||
Creates a CURLFile object, used to upload a file with <constant>CURLOPT_POSTFIELDS</constant>.
|
||||
</para>
|
||||
|
||||
&warn.undocumented.func;
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
|
@ -30,7 +28,7 @@
|
|||
<term><parameter>filename</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
||||
Path to the file which will be uploaded.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -38,7 +36,7 @@
|
|||
<term><parameter>mimetype</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
||||
Mimetype of the file.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -46,7 +44,7 @@
|
|||
<term><parameter>postname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
|
||||
Name of the file.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -56,7 +54,68 @@
|
|||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
|
||||
Returns a <type>CURLFile</type> object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title><function>curl_file_create</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* http://example.com/upload.php:
|
||||
<?php var_dump($_FILES); ?>
|
||||
*/
|
||||
|
||||
// Create a cURL handle
|
||||
$ch = curl_init('http://example.com/upload.php');
|
||||
|
||||
// Create a CURLFile object
|
||||
$cfile = curl_file_create('cats.jpg','image/jpeg','test_name');
|
||||
|
||||
// Assign POST data
|
||||
$data = array('test_file' => $cfile);
|
||||
curl_setopt($ch, CURLOPT_POST,1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||
|
||||
// Execute the handle
|
||||
curl_exec($ch);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
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)
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>curl_setopt</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
|
Loading…
Reference in a new issue