Jump to content

problem in Insert Adress of pic in db


msafvati

Recommended Posts

hi

I want to insert the address of picture in my DB (as for this script).

but when is insert them , my DB (ms-access) dont show me anything about Adreess or size or type or...(empty Record)

Please help me or if you know the better way for this operation  tell me

Thank u

 

 

<?php
if (isset ($_GET['upload'] ))
{
$name = $_FILES['picture']['name'];
$tmp_name= $_FILES['picture']['tmp_name'];
$type = $_FILES['picture']['type'];
$size= $_FILES['picture']['size'];

list($width,$height,$typeb,$attr)= getimagesize($tmp_name);
if ($width>600 || $height>500)
{
  echo $name."dimensions exceed the 600*500 Pixel Limited.";
  die();
}
# if (!(
# $type=='image/jpeg' ||
# $type=='image/png' ||
# $type=='image/gif'
# ))
# {
# echo $type."is not an acceptable Format.";
# }

if ($size>'350000') {
echo $name."is over 350KB. please make it smaller";
die();
     }
     }
     
     if (! get_magic_quotes_gpc()){
     $name= addslashes($name);
     
     $extract = fopen($tmp_name,'r');
     $content = fread ($extract,$size);
     $content = addslashes($content);
     fclose ($extract);
     }
      
      $con=odbc_connect("Test","","");
     $addfile = " insert into tblTest (name,size,type,content) ". " values ('$name','$size','$type','$content')";
      $result = odbc_do ($con,$addfile);
      odbc_close($con);
      
?>

 

Link to comment
Share on other sites

Well, you could just forego installing the client portion, and install the server instead.  Also, it may help to post the exact errors you are getting during the installation...  But I agree about going with MySQL and staying away from Access...

Link to comment
Share on other sites

Back to the topic of the thread. If the database code is inserting empty values, find out why the values are empty.

 

Your code has no error checking to make sure the upload worked before blindly executing the database query. You must check that the upload worked first - http://www.php.net/manual/en/features.file-upload.errors.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.