i have a problem with my upload

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simon2x1
    New Member
    • Dec 2008
    • 123

    i have a problem with my upload

    i have an upload page called upload.php and a display upload called display.php while i make use of my wamp server on my localhost and i access upload.php to upload an image the image go to a folder called picture and the image in this folder will display if i access the display.php page. now i have a webhost, in my file manager i have uploaded the two pages and i create the folder picture, if i visit my URL and i upload an image, the image will not go to the picture folder and also will not display in the display.php, want should i do, i my met to replace the file manager directory (/public_html/bypass_file/picture) with these (./picture) and also(<img src='public_htm l/bypass_file/picture/$present'/>) with(<img src='picture/$present'/>) or want should i do.

    Code:
    <?php
     upload.php
    
    
     if (isset($_POST['submit'])) {
     $filename = $_FILES['userfile']['name'];
     $tmpname  = $_FILES['userfile']['tmp_name'];
     $filesize = $_FILES['userfile']['size'];
     $filetype = $_FILES['userfile']['type'];
    	
     $filename = $_FILES['userfile']['name'];
     $result = @copy($_FILES['userfile']['tmp_name'], "./picture/$filename");
    	
     $fp      = @fopen($tmpname, 'r');
     $content = @fread($fp, filesize($tmpname));
     $content = addslashes($content);
     @fclose($fp);
    
     if(!get_magic_quotes_gpc())
    	{
      $filename = @addslashes($filename);
    			}
     mysql_query("INSERT INTO pixel (picname) VALUES('$filename')") or die(mysql_error());
    
     }else{
    <form method="post" action="upload.php" enctype="multipart/form-data">
    <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
     <input type="file" name="userfile" />
     <input type="submit" name="submit" value="Submit" />
    </form> 
    }
    ?>  
    
    
    <?php
    
     display.php 
    
     $sql = "SELECT * FROM pixel";
     $result1 = @mysql_query ($sql) or die('query error');
     $count = 0;
     while ($line = @mysql_fetch_array($result1, MYSQL_ASSOC)){
     $present = $line[picname];
     
     echo "<img src='picture/$present' width='65' height='65'/>";
     $count++;
    ?>
Working...