File uploads

File uploads – Uploading files via HTTP

How to use file uploads

Upload a PDF document

In this example a file named /home/johndoe/text.pdf is uploaded to the remote machine Additionally Basic Authentication is used to ensure that John is allowed to upload something.

require_once "HTTP/Request.php";

$req =& new HTTP_Request("");

$result $req->addFile('file_upload_field''/home/johndoe/text.pdf''application/pdf');
if (
PEAR::isError($result)) {
} else {

$response $req->sendRequest();

    if (
PEAR::isError($response)) {
    } else {
Making use of Cookies within HTTP_Request. (Previous) Adding additional headers to the HTTP request. (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.