wp+sql+image not goin in the folder
Posted
by
happy
on Stack Overflow
See other posts from Stack Overflow
or by happy
Published on 2012-09-15T09:17:12Z
Indexed on
2012/09/15
9:37 UTC
Read the original article
Hit count: 128
this is my code for uploading image in database but image are going to the desird forlder...but when i m tryin to retrieve the images to diaplay,,they are not displayed..anyone help me......
$category=$_POST['category'];
$uploadDir = 'D:/xampp/htdocs/js/wordpress/wp-content/plugins/img/imagess/ ';
$fileName = $_FILES['Photo']['name'];
$tmpName = $_FILES['Photo']['tmp_name'];
$fileSize = $_FILES['Photo']['size'];
$fileType = $_FILES['Photo']['type'];
$filePath = $uploadDir . $fileName;
$result = move_uploaded_file($tmpName,$filePath);
if (!$result)
{
echo "Error uploading file";
exit;
}
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
$filePath = addslashes($filePath);
}
global $wpdb;
//$insert=$wpdb->insert('images',array('image_name'=>$filePath,'cat_name'=>$category),array('%b','%s'));
$insert=$wpdb->insert('images',array('image_name'=>$filePath,'cat_name'=>$category));
$wpdb->insert('categories',array('cat_name'=>$category));
echo "Successfully Submitted";
© Stack Overflow or respective owner