title: Uploading PDF to database by using PHP form
body: <p>I am trying to upload pdf or word files with PHP to mysql database. my code works with images that i specified but it doesn't work with pdf and word files.</p>
  
  <p>here is my code with table of form and php code:</p>
  
  <pre><code>&lt;?php
  include("./upload.php");
  
  $dosyayolu="resimler/";
  $logos=yukleyici("logo",2048*1024,$dosyayolu);
  $links=yukleyici("link",20000000000000,$dosyayolu);
  
  if($logos!="1"){
  if($_POST['baslik']!=""){
  if(mysql_query("INSERT INTO gfsidocuments (baslik,logo,detay,link)              
  VALUES ('".$_POST['baslik']."','".$logos."','".$_POST['detay']."','".$links."')"));
  header( 'Location: ./gfsidocedit.php');
  }
  }
  }
  ?&gt;
  
  
  &lt;table border="0" width="100%" height="40" cellspacing="0" cellpadding="0"&gt;
  &lt;tr&gt;
  &lt;td width="100" bgcolor="#E1E1E1"&gt;&lt;font face="Tahoma" size="2"&gt;&amp;nbsp;Document&lt;/font&gt;&lt;/td&gt;
  &lt;td width="238" bgcolor="#E1E1E1"&gt;&lt;input type="file" name="link" id="link" size="20"&gt;&lt;/td&gt;
  &lt;td width="211" bgcolor="#E1E1E1"&gt;&lt;/td&gt;
  &lt;td bgcolor="#E1E1E1"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Here is the upload.php :</p>
  
  <pre><code>&lt;?php
  function yukleyici($filefield,$limit,$folder){
  if ( ($_FILES[$filefield]["type"] == "image/gif")
  || ($_FILES[$filefield]["type"] == "image/jpeg")
  || ($_FILES[$filefield]["type"] == "image/png")
  || ($_FILES[$filefield]["type"] == "application/pdf")
  || ($_FILES[$filefield]["type"] == "application/msword")
  )
  {
  if(($_FILES[$filefield]["size"] &lt; $limit)){
  $filename=getUniqueName() . $_FILES[$filefield]["name"];
  if(move_uploaded_file($_FILES[$filefield]["tmp_name"],
  realpath("../") . "/" . $folder . $filename)){
  return $folder . $filename;
  }else{
  return "1";
  }
  }else{
  return "1";
  }
  }else{
  return "1";
  }
  }
  function getUniqueName(){
  return substr(md5(uniqid(rand(), true)),1,10);
  }
  ?&gt;
  </code></pre>
  
  <p>As i said when i upload image it works, but when i upload pdf or word document it returns 1 to database... 
  İ assume that problem on determining size but i couldn't figure it out how to fix.</p>