Gallery

Started on the old forum in August 2009 · view the original in the archive · old links redirect here

14 replies · 722 views · started 17 years ago · 1 min read

5 participants
Pablo Developer · 164 posts #1

Warning: move_uploaded_file(gallery/photos/Yeah Thats Me....jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/chill/public_html/upload.php on line 192

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpPre4yT' to 'gallery/photos/Yeah Thats Me....jpg' in /home/chill/public_html/upload.php on line 192 Duplicate entry '/gallery/photos/.jpg' for key 2insert error

AM GETTING THIS ERROR AFTER I TRY TO UPLOAD A PHOTO USING MY UPLOADER I NEVER USE TO SEE THIS ERROR BUT ALL OF A SUDDEN SINSE I SWITCH HOST I SEE THAT CAN U TELL ME WATS WRONG?

Pablo Developer · 164 posts #3

what? i dnt understand

Pablo Developer · 164 posts #6

well i change it to 777 and still dont work

Pablo Developer · 164 posts #7

oh i got it now i chage the two folders to 777 and it work but the pictures not showing now

riderz Lead · 975 posts #8

create a folder gallery and inside the gallery create another folder /photos it should be then gallery/photos


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Pablo Developer · 164 posts #9

already did

Pablo Developer · 164 posts #11

is chmod the same as setting it to 777 if thats so yes i did

riderz Lead · 975 posts #12
Permission denied in /home/chill/public_html/upload.php on line 192

that line say it dnt have permision to upload pic to the file got to ur upload.php and make the place where the pics get uploaded


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Pablo Developer · 164 posts #13

that error is not there any more from i set the permission 777 this is line 192

gallery."/".photos."/".$_FILES["userfile"]["name"]);

i dnt see anything wrong there

riderz Lead · 975 posts #14

replace this part with urs in upload.php

/////////////////////////////////Members List
  error_reporting(E_ALL);
  // we first include the upload class, as we will need it here to deal with the uploaded file
  $userinfo = mysql_fetch_array(mysql_query("SELECT name, sex FROM ibwf_users WHERE id='".$uid."'"));
  $membername = $userinfo[0];
  // we have three forms on the test page, so we redirect accordingly
  if ($_POST['action'] == 'image') {
            echo "<p align=\"center\">";
      // ---------- IMAGE UPLOAD ----------
      // we create an instance of the class, giving as argument the PHP object
      // corresponding to the file field from the form
      // All the uploads are accessible from the PHP object $_FILES
      $handle = new Upload($_FILES['my_field']);
        // then we check if the file has been uploaded properly
      // in its *temporary* location in the server (often, it is /tmp)
      if ($handle->uploaded) {
            // yes, the file is on the server
          // below are some example settings which can be used if the uploaded file is an image.
          $handle->image_resize            = true;
          $handle->image_ratio_y           = true;
          $handle->image_x                 = 150;
            // now, we start the upload 'process'. That is, to copy the uploaded file
          // from its temporary location to the wanted location
          // It could be something like $handle->Process('/home/www/');
          $handle->Process('usergallery/');
          // we check if everything went OK
         if ($handle->processed) {
              // everything was fine !
                echo '  file uploaded with success<br/>';
              echo '  <img src="usergallery/' . $handle->file_dst_name . '" /><br/>';
              $info = getimagesize($handle->file_dst_pathname);
              echo '  link to the file just uploaded: <a href="usergallery/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a><br/>';
              $imageurl = "usergallery/$handle->file_dst_name";
              $reg = mysql_query("INSERT INTO ibwf_usergallery SET uid='".$uid."', imageurl='".$imageurl."', sex='".$userinfo[1]."', time='".(time() - $timeadjust)."'");
            } else {
              // one error occured
              echo '  file not uploaded to the wanted location<br/>';
              echo '  Error: ' . $handle->error . '<br/>';
           }
          // we delete the temporary files
          $handle-> Clean();
       } else {
          // if we're here, the upload file failed for some reasons
          // i.e. the server didn't receive the file
            echo '  file not uploaded on the server<br/>';
          echo '  Error: ' . $handle->error . '';
      }
      echo "</p>";

create a folder usergallery and chmod it to 777


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

Pablo Developer · 164 posts #15

here

<?php
header('Content-type: text/html; charset=utf-8');
header('Cache-Control: no-store, no-cache, must-revalidate');
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";

include("config.php");
include("core.php");
$bcon = connectdb();
$title = "Gallery";
echo "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"fav.ico\" />";
echo "<title>$title</title>";

?>
<style  type='text/css'>
body {
font-weight : normal;
font-size : small;
font-family : Verdana, Arial, Helvetica, sans-serif;
color : #000000;
background-color : #ADDFFF;
}
a {
color : #2c75b1;
}

a:active {
color : #0badf0;
}

a.red:visited {
color : #ff0000;
}

input {
	background-color: #ADDFFF; 
	color: #000000; 
	border: 1px solid #0000FF;
}

textarea {
	background-color: #ffffff; 
	color: #000000; 
	border: 1px solid #000000;
}

div.center {

text-align : center;
}

div.pagination {
border-top : 1px dotted #afcddc;
text-align : center;
}

div.footer {
border-top : 1px dotted #afcddc;
text-align : center;
background-color : #0a0a0b;
}

div.text {
color : #afcddc;
border-top : 1px dotted #000000;
text-align : center;
background-color : #fdfa02;
}

div.slitex {
border-top : 1px dotted #afcddc;
text-align : center;
background-color : #daefea;
}
div.xlite {
border-top : 1px dotted #afcddc;
text-align : left;
background-color : #ffffff;
}
div.slite {
border-top : 1px dotted #afcddc;
text-align : left;
background-color : #ffffff;
}

form {
margin : 0;
}
input, textarea, select {
font-family : Verdana, Arial, Helvetica, sans-serif;
font-size : 10px;
}

</style>
<?php
echo "</head>";
echo "<body><html>";

echo "<div class=\"slite\">";
echo "<small>";

echo "</small><br/>";
echo "</div>";

$sid = $_GET["sid"];
$x= $_GET["x"];
$uid = $_GET["uid"];
$cmnt = $_POST["cmnt"];
$filename = $_POST["filename"];
$usx = $_GET["usx"];
$uid = getuid_sid($sid);
 $uexist = isuser($uid);
if (!$bcon)
{
echo "<card id=\"main\" title=\"WapVibes\">";
echo "<p align=\"center\">";
echo "<img src=\"http://coding-talk.com/images/exit.gif\" alt=\"*\"/><br/>";

echo "</p>";
echo "</card>";
echo "</wml>";
exit();

}

if((islogged($sid)==false))
    {
        echo "<card id=\"main\" title=\"WapVibes\">";
      echo "<p align=\"center\">";
      echo "You are not logged in<br/>";
      echo "Or Your session has been expired<br/><br/>";
   echo "Username:<br/><input name=\"loguid\" format=\"*x\" maxlength=\"30\"/><br/>";
  echo "Password:<br/><input type=\"password\" name=\"logpwd\"  maxlength=\"30\"/><br/>";
  echo "<anchor>»Login<go href=\"login.php\" method=\"get\">";
  echo "<postfield name=\"loguid\" value=\"$(loguid)\"/>";
  echo "<postfield name=\"logpwd\" value=\"$(logpwd)\"/>";
  echo "</go></anchor>";
echo "<br/>Are you new Here?<a href=\"register.php\">Register</a><br/>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
if(istrashed($uid))
    {
        echo "<card id=\"main\" title=\"You are BANNED!!!\">";
      echo "<p align=\"center\">";
echo mojiva_ad($mojiva_params);
  echo "<br/>";
      echo "<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"x\"/><br/>";
      echo "You are <b>Banned</b><img src=\"http://coding-talk.com/images/notok.gif\" alt=\"x\"/> from Uploading photos to this Gallery<br/>";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='0'"));
      $remain = $banto[0]- time();
      $rmsg = gettimemsg($remain);
      echo "Time to finish your penalty: $rmsg<br/><br/>";
              echo "<br/><a href=\"index.php?action=main&sid=$sid\"><img src=\"http://coding-talk.com/images/home.gif\" alt=\"*\"/>Home</a><br/>";
      echo "</p>";
      echo "</card>";
      echo "</wml>";
      exit();
    }
if($x=="send"){

echo "<div class=\"text\">";
echo "Upload Result?<br/>";
echo "</div>";

$sexx = mysql_fetch_array(mysql_query("SELECT sex FROM ibwf_users WHERE id='".$uid."'"));

$usx = "$sexx[0]";
/////Body code below
echo "<div class=\"slite\">";
 

	$filename = $_FILES[userfile][name];
$type = $_FILES[userfile][type];
$size = $_FILES[userfile][size];
$ext = getext($filename);
 if($ext=="gif"||$ext=="jpg"||$ext=="png"||$ext=="JPG"||$ext=="jpeg"||$ext=="wbmp") {
$send = move_uploaded_file($_FILES["userfile"]["tmp_name"],
    
gallery."/".photos."/".$_FILES["userfile"]["name"]);

//copy (gallery."/".photos."/".$_FILES["userfile"]["name"],chillblock.wapdesire.com."/".gallery."/".photos."/".$_FILES["userfile"]["name"]);

//$time = time();

//$filenamexx = md5($time);
//$sitename = [url]http://chillblock.wapdesire.com/;[/url]
$userfilex = substr($filenamexx,0,4);
//$filenamef = rename("gallery/photos/$filename","gallery/photos/$userfilex.$ext");

$final = "$userfilex.$ext";

 $sql = mysql_query("INSERT INTO fun_gallery SET itemurl='$sitename/gallery/photos/".$final."', title='".$cmnt."', sex='".$usx."', uid='".$uid."'");
echo mysql_error();

if($sql){
echo "Your Photo was uploaded successfully<br/>";
$uid = getuid_sid($sid);
 $gtot = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM fun_gallery WHERE uid='".$uid."'"));

   echo "<a href=\"gallery.php?action=viewuser&who=$uid&sid=$sid\">Check out your Photos </a> you now have [$gtot[0]] photos<br/> or <br/>";
echo "<a href=\"upload.php?sid=$sid\">Upload More Photos</a><br/>";
}
else
{
echo "insert error<br/>";

echo "<a href=\"upload.php?sid=$sid\">Upload More Photos.</a><br/>";
}
}else{

echo "Somthing is wrong<br/>";
echo "<a href=\"upload.php?sid=$sid\">Upload More Photos?</a><br/>";
}

echo "</div>";

}

else{
$uid = $_GET["uid"];

echo "<div class=\"text\">";
echo "Upload Pictures To Your Gallery<br/>";
echo "</div>";

/////Body code below
echo "<div class=\"slite\">";
  addvisitor();
  addonline(getuid_sid($sid),"Uploading Photo","index.php?action=$action");
//echo "<font color=red><b><u>NOTE: ONLY POTOS OF YOU WILL BE ACCEPTED IN THE GALLERY. ALL OTHER PHOTOS SUCH AS CARS, FLOWERS, CELEBRITY, CARTOONS, GRAPHICS..., etc WILL BE DELETED.</u></b></font><br/>Please Follow these rules...<br/>";

echo "<form enctype=\"multipart/form-data\" action=\"upload.php?x=send&uid=$uid&sid=$sid&gen=$mof\" method=\"POST\">";
echo "Description:<br/> <textarea name=\"cmnt\" cols=\"28\" rows=\"3\"></textarea><br/>";

echo "Choose Picture<br/><input type=\"file\" name=\"userfile\"/><br/>";
echo "<br/><input type=\"submit\" value=\"upload\"/>";
echo "</form>";

echo "</div>";
}
/////Body code end
echo "<div class=\"text\">";

$uid = getuid_sid($sid);
 $gtot = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM fun_gallery WHERE uid='".$uid."'"));

   echo "<a href=\"gallery.php?action=viewuser&who=$uid&sid=$sid\">My Gallery [$gtot[0]]</a><br/>";

echo "<div class=\"slite\">";
echo "<small>";
//echo mojiva_ad($mojiva_params);
echo "</small><br/></div>";

echo "<a href=\"gallery.php?action=main&sid=$sid\">Gallery</a>";
echo "-";
echo "<a href=\"index.php?action=main&sid=$sid\">Home</a>";
echo "</div>";
///links();
echo "</body></html>";

?>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close