msafvati Posted March 21, 2008 Share Posted March 21, 2008 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 https://forums.phpfreaks.com/topic/97204-problem-in-insert-adress-of-pic-in-db/ Share on other sites More sharing options...
Lamez Posted March 21, 2008 Share Posted March 21, 2008 why don't you install mysql and phpmyadmin? Link to comment https://forums.phpfreaks.com/topic/97204-problem-in-insert-adress-of-pic-in-db/#findComment-497382 Share on other sites More sharing options...
msafvati Posted March 21, 2008 Author Share Posted March 21, 2008 i cant use from MYSQL because when i install mysql,it show me an error about Client if you help me about it,i install it on my Pc..Ok?Thank u Link to comment https://forums.phpfreaks.com/topic/97204-problem-in-insert-adress-of-pic-in-db/#findComment-497496 Share on other sites More sharing options...
pauleth Posted March 21, 2008 Share Posted March 21, 2008 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 https://forums.phpfreaks.com/topic/97204-problem-in-insert-adress-of-pic-in-db/#findComment-497497 Share on other sites More sharing options...
PFMaBiSmAd Posted March 21, 2008 Share Posted March 21, 2008 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 https://forums.phpfreaks.com/topic/97204-problem-in-insert-adress-of-pic-in-db/#findComment-497500 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.