Answers for "php file as string apache server"

PHP
1

transfer file using file_get_content

file_get_contents('http://url/to/upload/handler', false, $context);
Posted by: Guest on March-24-2020
0

transfer file using file_get_content

$filename = "/path/to/uploaded/file.zip";
$file_contents = file_get_contents($filename);    

$content =  "--".MULTIPART_BOUNDARY."rn".
            "Content-Disposition: form-data; name="".FORM_FIELD.""; filename="".basename($filename).""rn".
            "Content-Type: application/ziprnrn".
            $file_contents."rn";

// add some POST fields to the request too: $_POST['foo'] = 'bar'
$content .= "--".MULTIPART_BOUNDARY."rn".
            "Content-Disposition: form-data; name="foo"rnrn".
            "barrn";

// signal end of request (note the trailing "--")
$content .= "--".MULTIPART_BOUNDARY."--rn";
Posted by: Guest on March-24-2020

Browse Popular Code Answers by Language