mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 10:28:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@330522 c90b9560-bf6c-de11-be94-00142212c4b1
143 lines
3.2 KiB
XML
143 lines
3.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<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 a CURLFile object</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>CURLFile</type><methodname>curl_file_create</methodname>
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>mimetype</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>postname</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Creates a <classname>CURLFile</classname> object, used to upload a file with <constant>CURLOPT_POSTFIELDS</constant>.
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>filename</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Path to the file which will be uploaded.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>mimetype</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Mimetype of the file.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>postname</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Name of the file.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns a <classname>CURLFile</classname> 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>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|