Ciao io creai uno script per caricare le immagini da form per degli articoli salvandoli su DB.
Ho creato una cartella nel server chiamata imago_tmp e la snippet di script che fa tutto è questo:
codice:
$tmp_img_name = $_FILES['up_imago']['tmp_name'];
$img_name = $_FILES['up_imago']['name'];
$img_type = str_replace('image/', '',$_FILES['up_imago']['type']);
if($img_type == 'jpeg') $img_type = 'jpg';
$dati_raw = file_get_contents($tmp_img_name);
$this->Immagine = addslashes($dati_raw);
$this->Titolo = $_POST['titolo'];
$this->Slug = urlencode($this->Titolo);
$this->Testo = $_POST['testo'];
$strQuery = "INSERT INTO ".$this->strTable." VALUES(null,
'".$this->Slug."',
'".$this->Titolo."',
'".$this->Testo."',
'".$this->Immagine."',
'".$img_type."')";
$objStatment = $this->objPDO->prepare($strQuery);
$objStatment->execute();
Spero sia chiaro e risolva il tuo problema ciao