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 auf dem lokalen Host zu aktualisieren Code wird die Aktualisierung aber in Online-Server wird nicht aktualisiert, wie Sie den Code aktualisierenmeine Daten aktualisieren nicht auf Online-Server .die Daten auf lokalen aktualisiert

i actully Update-Code auf dem lokalen Host es aktualisiert, aber in Online-Server aktualisiert es nicht, wie der Code zu aktualisieren Actuully ich Update-Code auf dem lokalen Host ist es aktualisiert, aber in Online-Server aktualisiert es nicht, wie der Code zu aktualisieren

Antwort

1

Was Fehlercode bekommst du?

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.' 
Verwandte Themen