Click Button to Upload and Nothing :(

  •  08-29-2011, 3:23 PM

    Click Button to Upload and Nothing :(

    I have this working on my test site but will not work on my live site :(
    When I click the button to upload....Nothing happens.
    I have adapted this to record to a DB, upload to albums,  as well as to thumbnail images and keep aspect ratio.
    HELP!
    1. <?php  
    2. include "header.php";  
    3. ?>  
    4.  <div id='div-regForm'>  
    5.             <form id="form1" method="POST">  
    6.                 <?php   
    7.                   
    8.                 echo "<h2>Upload Your Photos</h2><br />";  
    9. echo "<u>Extensions</u> <b>jpg, png, gif</b> | <u>Max Size</u> <b>$msize</b><br /><br />";  
    10.  $sqlalbums = "SELECT * FROM `member_albums` WHERE `uid`='".mysql_real_escape_string($uid)."' ORDER BY `id` ASC";  
    11.         $result = mysql_query($sqlalbums);  
    12.         $noa = mysql_num_rows($result);  
    13.         if ($noa < 1){  
    14.             echo "You have no albums to upload to, please <a href='index.php?sa=crtalbum'>Create One</a> now.";  
    15.             }else{  
    16.                   while ($row = mysql_fetch_array($result)) {  
    17.   
    18.             $aid = $row["id"];  
    19.             $album = $row["album_name"];  
    20.             if ($lastalbum == $aid) {  
    21.                 $select = "selected";  
    22.             } else {  
    23.                 $select = "";  
    24.             }  
    25.             $album_selection .= "<OPTION NAME='$album' id='album' VALUE='$aid' $select>" . $album .  
    26.                 '</option>';  
    27.         }  
    28.         echo "<b>To Album:</b> <select name='album'>";  
    29.         ?>  
    30.         <?= $album_selection ?>  
    31.         <?php  
    32.         echo "</select><br /><br />";  
    33.                     $uploader=new PhpUploader();  
    34.                     $uploader->MaxSizeKB=10240;  
    35.                     $uploader->Name="myuploader";  
    36.                     $uploader->InsertText="Click Here To Upload Images";  
    37.                     $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif";      
    38.                     $uploader->MultipleFilesUpload=true;  
    39.                     $uploader->Render();  
    40.                     }  
    41.                       
    42.                       
    43.             function PhpGallery_Impl_LoadImage($imagefile)  
    44.                 {  
    45.                 $ext=pathinfo($imagefile,PATHINFO_EXTENSION);  
    46.                 switch(strtolower($ext))  
    47.                 {  
    48.                 case "png":  
    49.                 return imagecreatefrompng($imagefile);  
    50.                 case "gif":  
    51.                 return imagecreatefromgif($imagefile);  
    52.                 case "jpg":  
    53.                 case "jpeg":  
    54.                 default:  
    55.                 return imagecreatefromjpeg($imagefile);  
    56.                 }  
    57.                 }  
    58.             function PhpGallery_GenerateThumbnail($imagefile,$thumbpath,$width,$height)  
    59.             {  
    60.             $img=PhpGallery_Impl_LoadImage($imagefile);  
    61.             $old_x=imageSX($img);     
    62.             $old_y=imageSY($img);      
    63.     $new_w = 160;  
    64.     $new_h = 160;  
    65. $ratio1=$old_x/$new_w;    
    66. $ratio2=$old_y/$new_h;    
    67. if($ratio1>$ratio2)  {         
    68. $thumb_w=$new_w;          
    69. $thumb_h=$old_y/$ratio1;      
    70. }else{        
    71. $thumb_h=$new_h;          
    72. $thumb_w=$old_x/$ratio2;      
    73. }     
    74.             $thumb=imagecreatetruecolor($thumb_w,$thumb_h);  
    75.             imagecopyresized($thumb,$img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);  
    76.             imagejpeg($thumb,$thumbpath);  
    77.             imagedestroy($img);  
    78.             imagedestroy($thumb);  
    79.             }  
    80.             ?>  
    81.     </form>  
    82.    </div>           
    83.           
    84. <?php  
    85. $fileguidlist=@$_POST["myuploader"];  
    86. if($fileguidlist)  
    87. {  
    88. $guidlist=split("/",$fileguidlist);       
    89. $path="images/";  
    90. $thumbpath = "thumbs/";  
    91.     foreach($guidlist as $fileguid)      
    92.     {      
    93.         $mvcfile=$uploader->GetUploadedFile($fileguid);         
    94.         if($mvcfile)         
    95.         {    
    96.                           $o_filename = $mvcfile->FileName;  
    97.                         $ext = substr(strrchr($mvcfile->FileName, "."), 1);   
    98.                      $randName = md5(rand() * time());  
    99.                  $mvcfile->FileName = $randName . '.' . $ext;  
    100.         $mvcfile->MoveTo($path.$mvcfile->FileName);  
    101.         ##Insert Info Into DB  
    102.         $aid = mysql_real_escape_string($_POST["album"]);  
    103.                         setcookie('lastAlbum'''.$aid.'');  
    104.                         $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];  
    105.                         if ($ip == "") {  
    106.                             $ip = $_SERVER['REMOTE_ADDR'];  
    107.                         }  
    108.                         $isPriAlbum = mysql_query("SELECT * FROM member_albums WHERE id = '".$_POST['album']."'");  
    109.                         $rpa = mysql_fetch_array($isPriAlbum);  
    110.                         $priAlbum = $rpa['private'];  
    111.                         $albumName = $rpa['album_name'];  
    112.   
    113.                         $insert_images = mysql_query("INSERT INTO files (userid, username, image, filename, ip, date, private, album_name, albumid) VALUES ('$uid', '$user $userlast', '$mvcfile->FileName', '$o_filename', '$ip', '$date', '$priAlbum', '$albumName', '$aid')"or  
    114.                             die(mysql_error());  
    115.                         $updatedate = mysql_query("UPDATE `member_albums` SET `last_edit`='$date' WHERE `id` = '$aid'"or  
    116.                             die(mysql_error());  
    117.                               
    118.                             $getAname = mysql_query("SELECT album_name FROM member_albums WHERE id='" . $_POST['album'] . "'");  
    119.                         $albName = mysql_fetch_array($getAname);  
    120.                         $albumName = $albName['album_name'];  
    121.                           
    122.         $info = "<h2><img src=\"gfx/icons/newphotos.png\" title=\"New Member Photos!\"> New Photos Uploaded!</h2>";  
    123.         if ($priAlbum == 0){  
    124.   
    125.         $details = '<br /><a href="'.$siteURL.'profile.php?uid='.$uid.'">   ' . $user . ' ' . $userlast . '</a> just uploaded <a href="'.$siteURL.'index.php?p=album&aid=' . $_POST['album'] . '&uid=' . $uid . '&limit=' . $numPhotos .'">'.$numPhotos.'</a> new photos to <a href="'.$siteURL.'index.php?p=album&aid=' . $_POST['album'] . '&uid=' . $uid . '">'.$albumName.'</a>, go check them out!';  
    126.         }else{  
    127.          $details = '<a href="'.$siteURL.'profile.php?uid='.$uid.'">' . $user . ' ' . $userlast . '</a> just uploaded '.$numPhotos.' new photos to a private album!';     
    128.         }  
    129.         $chkupdates = mysql_query("SELECT * FROM `user_activity` WHERE `body` LIKE '%$albumName%' AND `type`='newphotos'");  
    130.         $yes = mysql_num_rows($chkupdates);  
    131.         if ($yes > 0){  
    132.             while($rou = mysql_fetch_array($chkupdates)){  
    133.             $oldID = $rou['id'];  
    134.             $deleteold = mysql_query("DELETE FROM `user_activity` WHERE `id` = '$oldID'");  
    135.             }  
    136.             }  
    137.                      $insertact = mysql_query("INSERT INTO `user_activity` (`uid`, `username`, `fid`, `date`, `type`, `info`, `body`, `time`) VALUES ('$uid', '$user $userlast', '$imageid', '$date', 'newphotos', '$info', '$details', CURDATE())");  
    138.           
    139.         ##End Insert Into DB  
    140.         PhpGallery_GenerateThumbnail($path.$mvcfile->FileName,$thumbpath.$mvcfile->FileName,160,160);  
    141.         }  
    142.               
    143.     }   
    144.          
    145.     }  
    146. ?>  
    147.                   
    148.     </div>  
    149.     <script type="text/javascript">   
    150.       
    151.     function CuteWebUI_AjaxUploader_OnStart()  
    152.     {  
    153.       var hidden=this;  
    154.        hidden.internalobject.insertBtn.style.display="none";  
    155.        hidden.internalobject.cancelBtn.style.visibility="hidden";  
    156.         hidden.internalobject.cancelBtn.style.display="none";  
    157.     }  
    158.       
    159.    </script>  
    160. <?  
    161. include "footer.php";  
    162. ?> 
     
View Complete Thread