}*/ $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 = ProjectTheme_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:
if ($uploads['basedir'] == $uploads['path']) { $img_url = $basedir . '/' . $pic; $ba = $basedir . '/'; $iii = $uploads['url']; } else { $img_url = $basedir . $year . '/' . $month . '/' . $pic; $ba = $basedir . $year . '/' . $month . '/'; $iii = $uploads['baseurl'] . "/" . $year . "/" . $month; } $oldPic_name = $img_url; $newpicname = 'copy_' . rand(0, 999) . '_' . $pic; $newPic_name = $uploads['path'] . '/' . $newpicname; //echo $oldPic_name.'<br/>'; //echo $newPic_name.'<br/>'; copy($oldPic_name, $newPic_name); ProjectTheme_insert_pic_media_lib($cid, $new_pid, $uploads['url'] . '/' . $newpicname, $newPic_name, $newpicname); //echo $newPic_name.'<br/>'; } //----------------------- } // lets submit it if (isset($_POST['project_submit1'])) { $project_title = trim(strip_tags($_POST['project_title'])); $project_description = nl2br(strip_tags($_POST['project_description'])); $project_category = strip_tags($_POST['project_cat_cat']); $project_location = trim($_POST['project_location_cat']); $project_tags = trim(strip_tags($_POST['project_tags'])); $price = projectTheme_clear_sums_of_cash(trim($_POST['price'])); $project_location_addr = strip_tags(trim($_POST['project_location_addr'])); //------------------------------- $adOK = 1;
}*/ $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 = ProjectTheme_insert_pic_media_lib($cid, $pid, $uploads['url'] . '/' . $xx, $targetFile, $namee); update_post_meta($id, 'act_dig_file', "1"); //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;