Beispiel #1
0
    	}*/
    $namee = $_FILES['Filedata']['name'];
    $namee = str_replace(" ", "-", $namee);
    $uploads = wp_upload_dir();
    if (!file_exists($uploads['path'])) {
        mkdir($uploads['path'], 777);
    }
    $tempFile = $_FILES['Filedata']['tmp_name'];
    //$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $xx = $tm . $rnd . "_" . str_replace(" ", "", $namee);
    $targetFile = $uploads['path'] . '/' . $xx;
    // str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
    // Uncomment the following line if you want to make the directory if it doesn't exist
    // mkdir(str_replace('//','/',$targetPath), 0755, true);
    move_uploaded_file($tempFile, $targetFile);
    $id = sitemile_insert_pic_media_lib($cid, $pid, $uploads['url'] . '/' . $xx, $targetFile, $namee, 'another_reserved1');
    //print_r($targetFile); echo "|"."a";
    echo $namee . "|" . $id;
    //$uploads['url']."/".$xx;
}
switch ($_FILES['Filedata']['error']) {
    case 0:
        $msg = "No Error";
        break;
    case 1:
        $msg = "The file is bigger than this PHP installation allows";
        break;
    case 2:
        $msg = "The file is bigger than this form allows";
        break;
    case 3:
Beispiel #2
0
    	}*/
    $namee = $_FILES['Filedata']['name'];
    $namee = str_replace(" ", "-", $namee);
    $uploads = wp_upload_dir();
    if (!file_exists($uploads['path'])) {
        mkdir($uploads['path'], 777);
    }
    $tempFile = $_FILES['Filedata']['tmp_name'];
    //$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $xx = $tm . $rnd . "_" . str_replace(" ", "", $namee);
    $targetFile = $uploads['path'] . '/' . $xx;
    // str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
    // Uncomment the following line if you want to make the directory if it doesn't exist
    // mkdir(str_replace('//','/',$targetPath), 0755, true);
    move_uploaded_file($tempFile, $targetFile);
    $id = sitemile_insert_pic_media_lib($cid, $pid, $uploads['url'] . '/' . $xx, $targetFile, $namee);
    //print_r($targetFile); echo "|"."a";
    echo $namee . "|" . $id;
    //$uploads['url']."/".$xx;
}
switch ($_FILES['Filedata']['error']) {
    case 0:
        $msg = "No Error";
        break;
    case 1:
        $msg = "The file is bigger than this PHP installation allows";
        break;
    case 2:
        $msg = "The file is bigger than this form allows";
        break;
    case 3: