6

Hi i am uploading files by this little code

<?php
$file="oks.html";
$cookie="*;";
$csrf="*";
$parent="*";
function up($d)
{
global $cookie,$csrf,$parent;
    $ch = curl_init("https://files.one.ubuntu.com/upload/");
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:8888"); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
    curl_setopt($ch, CURLOPT_POST, true);
    $post = array(
        "csrfmiddlewaretoken"=>$csrf,
        "file"=>"@".$d.";filename=r2fas1.html;type=text/html",
        "base"=>"/files/",
        "path"=>"/",
        "parent_key"=>$parent,
        "redirct"=>"False",
        "public"=>"on",
    );
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post); 
    $response = curl_exec($ch);
    return $response;
}
echo up($file);

but i want to send different file content is there a way to send string than real file ?

0 Answers0