PHP uploads and checking
<p><strong>Edited:</strong></p>

<p>Sorry for the inconvenience, when i look back the codes, it does not actually upload the files, it's only capture the file's info and store in the database, which later cannot be download by user coz there not exist such file anywhere... my questions is, how can i integrate this codes with move_uploaded_file() function?</p>

<hr>

<p>I want to update/insert file by using upload box to the database but before that it will check for the file type thats only pdf can be upload. Somthing wrong with the codes and i dont know what..Please help</p>

<p>here are part of my updates codes:</p>

<pre><code>$id=$rs['id']; 
$qry = "SELECT a.faillampiran FROM {$CFG-&gt;prefix}ptk_lampiran a, {$CFG-&gt;prefix}ptk b WHERE a.ptkid=$id and b.id=$id";

$sql = get_records_sql($qry);
if($_POST['check']){     
    $ext = pathinfo($faillampiran,PATHINFO_EXTENSION);      
    $err = "Upload Only PDF File. ";    
    if ($ext =='pdf'){          
        $qry="UPDATE {$CFG-&gt;prefix}ptk_lampiran SET 
        faillampiran='".$faillampiran."'                
        WHERE ptkid='".$_GET['id']."'";
        $sql=mysql_query($qry);     
        $qry = "SELECT a.faillampiran FROM {$CFG-&gt;prefix}ptk_lampiran a, {$CFG-&gt;prefix}ptk b
            WHERE b.id = '".$rs[id]."' AND a.ptkid = '".$rs[id]."' ";
        $sql = get_records_sql($qry);
        foreach($sql as $rs){ ?&gt;              
            &lt;?=basename($rs-&gt;faillampiran); ?&gt;&lt;br&gt;
        &lt;? } 
        ?&gt;              
        &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;
        &lt;input type="file" size="50" name="faillampiran" alt="faillampiran" value= "&lt;?=$faillampiran;?&gt;" /&gt;
        &lt;input type="submit" name="edit" value="Muat naik fail ini" /&gt;&lt;br /&gt;
        &lt;/td&gt;&lt;/tr&gt;  
    }       
    else {
        echo "&lt;script&gt;alert('$err')&lt;/script&gt;";
    }

} else { 

foreach($sql as $rs){ ?&gt;              
    &lt;?=basename($rs-&gt;faillampiran); ?&gt;&lt;br&gt;
&lt;? } 

?&gt;
&lt;input type="file" size="50" name="faillampiran" alt="faillampiran" value= "&lt;?=$faillampiran;?&gt;" /&gt;
&lt;input type="submit" name="edit" value="Muat naik fail ini" /&gt;&lt;br /&gt;
&lt;?}
</code></pre>

<p>Sori bout the messiness of the codes, im still a beginner in this languages.</p>

<p>thx</p>
