Page 1 of 1

$HTTP_POST_FILES IS not displaying the file name extensionunable to install n db

Posted: Tue Sep 27, 2005 7:54 am
by mns_saigopal
I AM using a file upload template

as follows



 



 
   
 
         
     

Files to upload:

    Upload Image:
     
     
    Click browse to upload a local file
   
   


i am passing the txtfileupload in a page like this following way

i am unable to display the type of the file extension of the file uploaded and not able to insert in the database and hence i am unable to get the output of image file in the page


";
print $typ." type";
$chars = split("/",$typ);
print $chars[1]." type";
require_once("lib/properties.php");
require_once("lib/configure.php"); //for the rights constans.
session_start();
$title=$_REQUEST['textarea2'];
$uid= $_SESSION['loguid'];
if($uid=='')
{
$_SESSION['loguid']="Guest";

$uid=  $_SESSION['loguid'];
}
     
    if( $_SESSION['languageid']=='')
    {
       
        $_SESSION['languageid']=2;
        $languageid= $_SESSION['languageid'];
    }
    else
        $languageid=$_SESSION['languageid'];
               
  $vid=$_REQUEST['visionid'];
$_SESSION['id']= $vid;
$menuid=$_SESSION['id'];

  $ob=new Properties;
  $ob->openDB(); 
    $ob->seluccassDB();



$qry = "select max(categories_id) from categories";

$res = mysql_query($qry);
$row = mysql_fetch_row($res);
$date1= date("Y:m:d:G:i:s");
$id = $row[0];
$id1= $id+1;

$qry2 = sprintf("update categories set categories_id='%s'",$id1);

mysql_query($qry2);
$docroot=$_SERVER['DOCUMENT_ROOT'];
$path=pathinfo($_SERVER['PHP_SELF']);
$imgpath=$docroot.$path["dirname"];
$fname=$imgpath."/kk".$id.".".$chars[1];
print $fname;
$fname1="kk".$id.".".$chars[1];

move_uploaded_file($st,$fname);

$selqry="select * from languages";
$rslang=mysql_query($selqry);

while($rowlang=mysql_fetch_array($rslang,MYSQL_BOTH))
{
$langid=$rowlang['languages_id'];
$insqry=sprintf("insert into categories(categories_id,categories_image,date_added,title) values('%s','%s','%s','%s')",$id1,$fname1,$date1,$title);

print $insqry;
mysql_query($insqry);

$insqry1=sprintf("insert into categories_description(categories_id,language_id) values('%s','%s')",$id1,$langid);
//print $insqry1;
mysql_query($insqry1);

}
print "";
  print "";
  print " ";
  print "Title : . $title";

  print " ";



?>









anybody please give me reply immediately

thanks in advance

saigopal

Re: $HTTP_POST_FILES IS not displaying the file name extensionunable to install

Posted: Thu Sep 29, 2005 1:44 am
by sjg
It doesn't look like you're using any of the CMS Made Simple infrastructure, so it's hard for me to diagnose exactly what's going on.

In any case, I've had success in the past using the $_FILES array.

Basically, if your form has , you should be able to get the MIME type using $_FILES['ul']['type'].

Good luck!
___Samuel___

Re: $HTTP_POST_FILES IS not displaying the file name extensionunable to install n db

Posted: Wed Oct 05, 2005 10:43 am
by mns_saigopal
Hi samuel
The MIME type is working fine., but i am unable to see the image file name complete in the browser when i click properties i could see only "kk339." in the i-frame but the i frame not displaying the image filename extension.


[attachment deleted by admin]