2016-04-10 5 views
0
<?php include('../include/config.php'); 
if(empty($_SESSION['sus']) && empty($_SESSION['spa'])) 
{ 
    echo "<script>window.location='index.php'</script>"; 
} 
/*##########################################*/ 
$id=$_GET['id']; 

if(isset($_POST['save'])) 
                { 

              define ("MAX_SIZE","1000"); 
              function getExtension($str) 
              { 
               $i = strrpos($str,"."); 
               if (!$i) { return ""; } 
               $l = strlen($str) - $i; 
               $ext = substr($str,$i+1,$l); 
               return $ext; 
              } 

              $errors=0; 
              $image=$_FILES['image']['name']; 
              if ($image) 
              { 
               $filename = stripslashes($_FILES['image']['name']); 
               $extension = getExtension($filename); 
               $extension = strtolower($extension); 
               if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") 
                && ($extension != "gif")&& ($extension != "JPG") && ($extension != "JPEG") 
                && ($extension != "PNG") && ($extension != "GIF")) 
               { 
                echo '<h3>Unknown extension!</h3>'; 
                $errors=1; 
               } 
               else 
               { 
                $size=filesize($_FILES['image']['tmp_name']); 

                if ($size > MAX_SIZE*1024) 
                { 
                 echo '<h4>You have exceeded the size limit!</h4>'; 
                 $errors=1; 
                } 

                $image_name=time().'.'.$extension; 
                $newname="img/".$image_name; 


                $copied = copy($_FILES['image']['tmp_name'], $newname); 
                if (!$copied) 
                { 
                 echo '<h3>Copy unsuccessfull!</h3>'; 
                 $errors=1; 
                } 
                else //echo '<h3>uploaded successfull!</h3>'; 


           $title=$_POST['title']; 

           $content=$_POST['content']; 
           $sql="update home set title='$title',content='$content',img='$newname' where id='$id'"; 
             $res=mysql_query($sql); 
              if($res) 
              { 
               echo "<script>alert('You have successfully Uploaded')</script>"; 
            echo "<script>window.location='admin_home.php'</script>"; 
                } 
                else{ 
                 echo "failed submit"; 
             echo "<script>window.location='admin_home.php'</script>"; 
                } 

               } 
              } 

} 
?> 

actully私は更新コードに更新しているオンラインサーバー上で更新されていないIローカルホスト上のコードを更新していますが、オンラインサーバーではコードの更新方法は更新されていません ローカルホスト上のコードを更新していますが、更新中ですがオンラインサーバーではコードを更新する方法はありません私のデータは.theのデータは、それが更新しているが、オンラインのサーバでは、コードを</p> <p>actully更新する方法を更新していないローカルホスト上のローカル

答えて

1

エラーコードを取得できますか?

echo $_FILES['image']['error'] 

0 => 'There is no error, the file uploaded with success' 
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini' 
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form' 
3 => 'The uploaded file was only partially uploaded' 
4 => 'No file was uploaded' 
6 => 'Missing a temporary folder' 
7 => 'Failed to write file to disk.' 
8 => 'A PHP extension stopped the file upload.' 
関連する問題