Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

transfer file using file_get_content

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

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

".
            $file_contents."
";

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

".
            "bar
";

// signal end of request (note the trailing "--")
$content .= "--".MULTIPART_BOUNDARY."--
";
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #transfer #file
ADD COMMENT
Topic
Name
9+5 =