From cdeccb82f879a280ddd8f24c02d34a4a604d94f2 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Sun, 18 Apr 2004 07:10:44 +0000 Subject: [PATCH] CHMOD uploaded files to make sure they're writable. git-svn-id: https://develop.svn.wordpress.org/trunk@1091 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/upload.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-admin/upload.php b/wp-admin/upload.php index e327ff32de..fa81e144ac 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -128,8 +128,11 @@ case 'upload': if (!$moved) { die("Couldn't Upload Your File to $pathtofile2."); } else { + chmod($pathtofile2, 0666); @unlink($img1); } + + // // duplicate-renaming function contributed by Gary Lawrence Murphy ?> @@ -162,13 +165,14 @@ die(); @$moved = move_uploaded_file($img1, $pathtofile); //Path to your images directory, chmod the dir to 777 // move_uploaded_file() can fail if open_basedir in PHP.INI doesn't // include your tmp directory. Try copy instead? - if(!moved) { + if(!$moved) { $moved = copy($img1, $pathtofile); } // Still couldn't get it. Give up. if (!moved) { die("Couldn't Upload Your File to $pathtofile."); } else { + chmod($pathtofile, 0666); @unlink($img1); } @@ -219,7 +223,7 @@ Type:

-

Start over.

+

Upload another.