digitalgod Posted July 30, 2006 Share Posted July 30, 2006 hey guys,I have this pic upload system that creates the folder if it doesn't exist and makes a thumbail of the pic. It worked perfectly a while ago but now from time to time it won't upload a file saying that it doesn't have Permission and if I try to delete other folders it gives me a Bad File Descriptor error...is it because of my code or something??here's an example[code]<?phpfunction createthumb($name, $filename, $new_w, $new_h){ $system = explode('.', $name); if (preg_match('/jpg|jpeg/', $system[1])) { $src_img = imagecreatefromjpeg($name); } if (preg_match('/png/', $system[1])) { $src_img = imagecreatefrompng($name); } $old_x = imageSX($src_img); $old_y = imageSY($src_img); if ($old_x > $old_y) { $thumb_w = $new_w; $thumb_h = $old_y * ($new_h / $old_x); } if ($old_x < $old_y) { $thumb_w = $old_x * ($new_w / $old_y); $thumb_h = $new_h; } if ($old_x == $old_y) { $thumb_w = $new_w; $thumb_h = $new_h; } $dst_img = ImageCreateTrueColor($thumb_w, $thumb_h); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y); if (preg_match("/png/", $system[1])) { imagepng($dst_img, $filename); } else { imagejpeg($dst_img, $filename); } imagedestroy($dst_img); imagedestroy($src_img);}$upload_par = "img/clubs";$upload_dir = $upload_par . "/" . $name . "/";$upload_tdir = $upload_dir . "thumbnails/";$num_files = 1; if (!is_dir("$upload_par")) { mkdir($upload_par);}if (!is_dir("$upload_dir")) { mkdir($upload_dir); mkdir($upload_tdir);}$new_file = $_FILES['file'];$file_name = $new_file['name'];$file_tmp = $new_file['tmp_name'];if (move_uploaded_file($file_tmp, $upload_dir . $file_name)) { array_push($names, $file_name); createthumb($upload_dir . $file_name, $upload_tdir . $file_name, 125, 125);} else { echo "File $i: Faild to upload.<br>";}?>[/code]anyone know why that happens to my folders/files?? It's really annoing Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.