Jump to content

Recommended Posts

I have a file upload script I am using to upload photos to a file on a yahoo server, however after they are uploaded, the server is not allowing access to the file.  It gives the following error message:

 

"

Sorry, Forbidden.

You don't have permission to access this URL on this server.

 

Additionally, a 410 Gone error was encountered while trying to use an ErrorDocument to handle the request.

 

Please check the URL for proper spelling and capitalization. If you're having trouble locating a destination on Yahoo!, try visiting the Yahoo! home page or look through a list of Yahoo!'s online services. Also, you may find what you're looking for if you try searching below.

"

 

 

I am not able to access the photos, even though they are showing up on the server.  I am thinking maybe thr script is in need of a CHMOD code, but im not familiar with it.  I was wondering if you would add it into a an upload script, or if you would us it when opening the file in the script that pulls its location from a php table.  The upload script follows:

 

 

<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 200000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {

    if (file_exists("../Graphics/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "../Graphics/" . $_FILES["file"]["name"]);
      }
}
}

$Name = $_POST['Name'];
$Pic = $_FILES["file"] ["name"];
$Category = $_POST['Category'];

include("database.php");

mysql_select_db("bluemoonmastiff", $con);
  
  $sql="INSERT INTO gallery (Name,PicAddress,Category)
              VALUES ('$Name','../Graphics/$Pic','$Category')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  
echo "Invalid file";

    
  }
else
  {
       include("photos.php");

       echo "File Uploaded"
  }
?> 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title></title>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <style type="text/css">
    a:link {text-decoration: none;}
    a:visited {text-decoration: none;}
  </style>
<script type="text/javascript" src="jquery-1.2.6.pack.js"></script>

<style type="text/css">

/*Make sure your page contains a valid doctype at the top*/
#simplegallery1{ //CSS for Simple Gallery Example 1
position: relative; /*keep this intact*/
visibility: hidden; /*keep this intact*/
border: 2px solid darkred;
border-color: #FFFFFF;
}

#simplegallery1 .gallerydesctext{ //CSS for description DIV of Example 1 (if defined)
text-align: left;
padding: 2px 5px;
}

</style>

<script type="text/javascript" src="simplegallery.js">

/***********************************************
* Simple Controls Gallery- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/

</script>  

<script type="text/javascript">
var mygallery=new simpleGallery({
wrapperid: "simplegallery1", //ID of main gallery container,
dimensions: [280, 200], //width/height of gallery in pixels. Should reflect dimensions of the images exactly
imagearray: [

<?php

Include("database.php"); 
               
mysql_select_db("bluemoonmastiff", $con);

$result = mysql_query("SELECT * FROM gallery WHERE Category='Pepper'");
while($row = mysql_fetch_array($result))
                  {

                  echo "$row[7]";

	  echo "$row[2]";
                  
                  echo "$row[8]";    

                  	 
                  }
                  
?>


	['../Graphics/bmm_Logo_Slide.jpg', '', '', '']
],
autoplay: [true, 3500, 1000], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
oninit:function(){ //event that fires when gallery has initialized/ ready to run
	//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
},
onslide:function(curslide, i){ //event that fires after each slide is shown
	//Keyword "this": references current gallery instance
	//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
	//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
}
})
</script>


</head>
<body bgcolor="#000000" text="#FFFFFF" link="#FF0000" vlink="#FF0000" alink="#FFFFFF">
<div style="position:absolute;left:2%;top:5%;height:79%;width:16%;">
<center>
<font size="5" face="Arial"><b><u>Site Guide</u></b></font><br><br>
<font size="4" face="Arial"><a href="index.html">Home</a></font><br><br>
<font size="4" face="Arial"><a href="girls.php">Our Girls</a></font><br><br>
<font size="4" face="Arial"><a href="guys.php">The Guys</a></font><br><br>
<font size="4" face="Arial"><a href="puppies.php">The Puppies</a></font><br><br>
<font size="4" face="Arial"><a href="about.php">Our Story</a></font><br><br>
<font size="4" face="Arial"><a href="contact.php">Contact Us</a></font><br><br>
<font size="4" face="Arial"><a href="purchase.php">Purchase</a></font><br><br>
</center>
</div>
<div style="position:absolute;left:18%;top:5%;height:45%;width:26%;">
<img src="../Graphics/bmm_Logo.jpg" width="100%" height="99%" alt="" border="1" align="" style="border-color:#FFFFFF;">
</div>
<div style="position:absolute;left:44%;top:5%;height:79%;width:55%;">
<font size="6" face="Arial"><b><u><center>Pepper</center></u></b></font><br><br>
<center><div id="simplegallery1"></div></center><br><br>
<font size="3" face="Arial">
<?php
include("database.php");

mysql_select_db("bluemoonmastiff", $con);

$result = mysql_query("SELECT * FROM girls WHERE page='pepper'");

while($row = mysql_fetch_array($result))
{
echo "<center>$row[2]</center>";
}



?>



</font>
</div>
<div style="position:absolute;left:18%;top:51%;height:33%;width:26%;">
<br>
<font size="5" face="Arial"><b><center><a href="sadie.php">Sadie</a></center></b></font><br>
<font size="5" face="Arial"><b><center><a href="sierra.php">Sierra</a></center></b></font><br>
<font size="5" face="Arial"><b><center><a href="pepper.php">Pepper</a></center></b></font><br>
</div>
<div style="position:absolute;left:2%;top:85%;height:13%;width:98%;">
</div>
</body>
</html>


 

 

I appreciate any help you can provide!!

Link to comment
https://forums.phpfreaks.com/topic/204554-chmod-question/
Share on other sites

Try your database insert as:

 

$sql="INSERT INTO gallery (Name,PicAddress,Category)
              VALUES ('$Name','Graphics/$Pic','$Category')";

 

The ../ may be messing this up.  Not for certain.  ../ in a url drops the previous directory.  If your gallery resides at  http://mysite.com/gallery.php, then it will look for the pics at http://mysite.com/Graphics/pics.jpg.

 

But, if you gallery resides at http://mysite.com/gallery/gallery.php, then it will look for the pics at http://mysite.com/Graphics/pics.jpg.

Link to comment
https://forums.phpfreaks.com/topic/204554-chmod-question/#findComment-1071147
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.