Jump to content

oskans

Yeni Üye
  • Posts

    2
  • Joined

  • Last visited

Posts posted by oskans

  1. Aşagıda kod ile upload yapıyorum fakat ismi dosya ısmı degil sebebi nedir acaba yardımcı olurmusunuz?

     

    <?php
    function yandexDiskUpload($user, $password, $file, $fileName = NULL, $folder =dosya)
    {
    $yandexWebDavUrl = $folder ? "https://webdav.yandex.com.tr/$folder/": "https://webdav.yandex.com.tr/";
    $fileHandler = fopen($file['tmp_name'], 'r');
    $fileDetails = explode('.', strtolower($file['name']));
    $findExtension = end($fileDetails);
    if ( isset($fileName) ) $fileName = $fileName.'.'.$findExtension; else $fileName = uniqid().'.'.$findExtension;

    $ch = curl_init($yandexWebDavUrl . $fileName);
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt($ch, CURLOPT_USERPWD, "$user:$password");
    curl_setopt($ch, CURLOPT_PUT, TRUE);
    curl_setopt($ch, CURLOPT_INFILE, $fileHandler);
    $result = curl_exec($ch);

    fclose($fileHandler);

×
×
  • Create New...