failed to open stream
Posted: Sun May 14, 2006 8:27 pm
all my directorys such as wallpapers wallpapers/800x600 wallpapers/1024x768 are chmodded to 777
anybody know why im getting these errors.
Warning: move_uploaded_file(wallpapers/800x600/1.jpg): failed to open stream: Permission denied in /mounted-storage/home16a/sub002/sc18478-RGIJ/www/admin_wallpapers.php on line 186
Warning: move_uploaded_file(): Unable to move '/tmp/php4gvh9w' to 'wallpapers/800x600/1.jpg' in /mounted-storage/home16a/sub002/sc18478-RGIJ/www/admin_wallpapers.php on line 186
Warning: imagecreatefromjpeg(wallpapers/800x600/1.jpg): failed to open stream: No such file or directory in /mounted-storage/home16a/sub002/sc18478-RGIJ/www/admin_wallpapers.php on line 190
Problem In opening Source Image
anybody know why im getting these errors.
Warning: move_uploaded_file(wallpapers/800x600/1.jpg): failed to open stream: Permission denied in /mounted-storage/home16a/sub002/sc18478-RGIJ/www/admin_wallpapers.php on line 186
Warning: move_uploaded_file(): Unable to move '/tmp/php4gvh9w' to 'wallpapers/800x600/1.jpg' in /mounted-storage/home16a/sub002/sc18478-RGIJ/www/admin_wallpapers.php on line 186
Warning: imagecreatefromjpeg(wallpapers/800x600/1.jpg): failed to open stream: No such file or directory in /mounted-storage/home16a/sub002/sc18478-RGIJ/www/admin_wallpapers.php on line 190
Problem In opening Source Image
Code: Select all
print '
<form action="" method="post" enctype="multipart/form-data">
<p><font color="#990033"><strong><center>Wallpaper Upload</center></strong></font></p>
<input name="author" type="text" value="unknown" size="40" maxlength="25"><strong>Author</strong><br>
<input name="author_url" type="text" value="http://" size="40" maxlength="25"><strong>Author URL</strong><br>
<input name="title" type="text" size="40" maxlength="25"> <strong>Title</strong>
<br>
<input name="file" type="file" id="file" size="40" /><strong>800x600 wallpaper</strong><br>
<input name="file2" type="file" id="file2" size="40" /><strong>1024x768 wallpaper</strong><br>
<select name="select">';
$result = mysql_query( "SELECT * FROM wallpaper_cats WHERE sub_cat <> '0'" );//
$row=mysql_fetch_array($result); //Store Record Of Data in $row
while($row=mysql_fetch_array($result) )
{
$catid = $row['sub_cat'];
$result2 = mysql_query( "SELECT * FROM wallpaper_cats WHERE id = '$catid'" );//
$row2=mysql_fetch_array($result2); //Store Record Of Data in $row
print '<option value="' . $row['id']. '">'. $row2['cat_name'] . ' :: ' .$row['cat_name'] . '</option>';
}
print '
</select>
<strong>Category</strong><br>
<br/>
<input type="submit" name="submit" value="Submit" />
</form>';
if ($_FILES["file"]["name"] <> "")
{
$file = strtolower($_FILES["file"]["name"]);
if (stristr($file,".jpg") == TRUE )
{
$result = mysql_query( "SELECT * FROM wallpaper_800_600 ORDER by id DESC" );//
$row=mysql_fetch_array($result); //Store Record Of Data in $row
$row=mysql_fetch_array($result);
$loc = $row['id'] + 1;
move_uploaded_file($_FILES["file"]["tmp_name"], "wallpapers/800x600/" . $loc . '.jpg');
//SAVE THUMBNAIL
$srcimg = imagecreatefromjpeg ("wallpapers/800x600/" . $loc . '.jpg')
or die ("Problem In opening Source Image"); // For JPEG
imagecopyresampled ($destimg, $srcimg, 0, 0, 0, 0, 150, 150, imagesx($srcimg) , imagesy($srcimg))
or die ("Problem In resizing"); // Resample the image from $srcimg to the $destimg
imagejpeg ($destimg, "wallpapers/thumbs/800x600/" . $loc . ".jpg") or die("Problem In saving"); // Save JPG
}
elseif (stristr($file,".png") === TRUE)
{
$result = mysql_query( "SELECT FROM wallpaper_800_600 ORDER by DESC" );//
$row=mysql_fetch_array($result); //Store Record Of Data in $row
$row=mysql_fetch_array($result);
$loc = $row['id'] + 1;
move_uploaded_file($_FILES["file"]["tmp_name"], "wallpapers/800x600/" . $loc . '.png');
//SAVE THUMBNAIL
$srcimg = imagecreatefrompng ("wallpapers/800x600/" . $loc . '.png')
or die ("Problem In opening Source Image"); // For PNG
imagecopyresampled ($destimg, $srcimg, 0, 0, 0, 0, 150, 150, imagesx($srcimg) , imagesy($srcimg))
or die ("Problem In resizing"); // Resample the image from $srcimg to the $destimg
imagepng ($destimg, "wallpapers/thumbs/800x600/" . $loc . ".png") or die("Problem In saving"); // Save JPG
}
else
{
print 'The file is not a .jpg or .png.';
}
unset($_POST['file']);
}
if ($_FILES["file2"]["tmp_name"] <> "")
{
$file = strtolower($_FILES["file2"]["name"]);
if (stristr($file,".jpg") === TRUE )
{
$result = mysql_query( "SELECT FROM wallpaper_1024x768 ORDER by DESC" );//
$row=mysql_fetch_array($result); //Store Record Of Data in $row
$row=mysql_fetch_array($result);
$loc = $row['id'] + 1;
move_uploaded_file($_FILES["file"]["tmp_name"], "wallpapers/800x600/" . $loc . '.jpg');
//SAVE THUMBNAIL
$srcimg = imagecreatefromjpeg ("wallpapers/800x600/" . $loc . '.jpg')
or die ("Problem In opening Source Image"); // For JPEG
imagecopyresampled ($destimg, $srcimg, 0, 0, 0, 0, 150, 150, imagesx($srcimg) , imagesy($srcimg))
or die ("Problem In resizing"); // Resample the image from $srcimg to the $destimg
imagejpeg ($destimg, "wallpapers/thumbs/800x600/" . $loc . ".jpg") or die("Problem In saving"); // Save JPG
}
elseif (stristr($file,".png") === TRUE)
{
$result = mysql_query( "SELECT FROM wallpaper_1024x768 ORDER by DESC" );//
$row=mysql_fetch_array($result); //Store Record Of Data in $row
$row=mysql_fetch_array($result);
$loc = $row['id'] + 1;
move_uploaded_file($_FILES["file"]["tmp_name"], "wallpapers/800x600/" . $loc . '.png');
//SAVE THUMBNAIL
$srcimg = imagecreatefrompng ("wallpapers/1024x768/" . $loc . '.png')
or die ("Problem In opening Source Image"); // For PNG
imagecopyresampled ($destimg, $srcimg, 0, 0, 0, 0, 150, 150, imagesx($srcimg) , imagesy($srcimg))
or die ("Problem In resizing"); // Resample the image from $srcimg to the $destimg
imagepng ($destimg, "wallpapers/thumbs/1024x768/" . $loc . ".png") or die("Problem In saving"); // Save JPG
}
else
{
print 'The file is not a .jpg or .png.';
}
unset($_POST['file2']);
}