bagder: curl-www/libcurl/php/examples authors.txt, 1.6, 1.7 httpfileupload.php, NONE, 1.1 httpfileupload.php.html, NONE, 1.1
| Newsgroups | gmane.comp.web.curl.www.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/curl/curl-www/libcurl/php/examples
In directory labb:/tmp/cvs-serv25209
Modified Files:
authors.txt
Added Files:
httpfileupload.php httpfileupload.php.html
Log Message:
new example
Index: authors.txt
===================================================================
RCS file: /cvsroot/curl/curl-www/libcurl/php/examples/authors.txt,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- authors.txt 17 Nov 2007 10:42:37 -0000 1.6
+++ authors.txt 17 Jan 2008 19:17:39 -0000 1.7
@@ -10,3 +10,4 @@
rss-adsense.php <a href="http://planetOzh.com">Ozh</a>
put.php Julian Bond
google-analytics-login.php <a href="http://www.askapache.com/">AskApache.com</a>
+httpfileupload.php <a href="http://daniel.haxx.se/">Daniel Stenberg</a>
--- NEW FILE: httpfileupload.php.html ---
Shows how to submit and upload a file to a HTML upload form.
--- NEW FILE: httpfileupload.php ---
<?php
//
// This sample shows how to fill in and submit data to a form that looks like:
//
// <form enctype="multipart/form-data"
// action="somewhere.cgi" method="post">
// <input type="file" name="sampfile">
// <input type="text" name="filename">
// <input type="text" name="shoesize">
// <input type="submit" value="upload">
// </form>
//
// Pay attention to:
// #1 - the input field names (name=)
// #2 - the input field type so that you pass the upload file to the right
// name
// #3 - what URL to send the POST to. The action= attribute sets it.
//
// Author: Daniel Stenberg
$uploadfile="/tmp/mydog.jpg";
$ch = curl_init("http://formsite.com/somewhere.cgi");
curl_setopt($ch, CURLOPT_POSTFIELDS,
array('sampfile'=>"@$uploadfile",
'shoesize'=>'9',
'filename'=>"fake name for file"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
curl_close($ch);
print "$postResult";
}
?>