php get from file code example
Example 1: php get file contents
<?php
file_get_contents("file.txt");
?>
Example 2: transfer file using file_get_content
file_get_contents('http://url/to/upload/handler', false, $context);
Example 3: transfer file using file_get_content
$filename = "/path/to/uploaded/file.zip";
$file_contents = file_get_contents($filename);
$content = "--".MULTIPART_BOUNDARY."\r\n".
"Content-Disposition: form-data; name=\"".FORM_FIELD."\"; filename=\"".basename($filename)."\"\r\n".
"Content-Type: application/zip\r\n\r\n".
$file_contents."\r\n";
$content .= "--".MULTIPART_BOUNDARY."\r\n".
"Content-Disposition: form-data; name=\"foo\"\r\n\r\n".
"bar\r\n";
$content .= "--".MULTIPART_BOUNDARY."--\r\n";