Jump to content
Fórum Script Brasil
  • 0

UPLOAD IMAGEM (PHP + SQL SERVER)


brunnosena
 Share

Question

 

 

Srs (a). bom dia.

Estou com um problema em um determinado script. No upload de fotos, faço da seguinte forma.

TABELA DO BD:
 

CODARQUIVO int
CODCOLIGADA int
CODLOCAL int
CODATENDIMENTO int
CODCOLIGADAATENDENTE int
CODATENDENTE int
NOMEARQUIVO varchar
DETALHESARQUIVO varchar
ARQUIVO image
TAMANHOARQUIVO RMDVALOR4
CODCOLIGADAATENDATUAL int
CODATENDENTEATUAL int
DATAULTIMAALTERACAO datetime
TIPOALTERACAO varchar
RECCREATEDBY varchar
RECCREATEDON datetime
RECMODIFIEDBY varchar
RECMODIFIEDON datetime

 

TRANSFORMAÇÃO DO CAMPO $_FILES:

$foto = $_FILES['ffFoto'];
$nome = $foto['name'];
$tipo = $foto['type'];
$tamanho = $foto['size'];


$conteudo = file_get_contents($foto['tmp_name']);                
$data = unpack("H*hex", $conteudo);         
$texto = "0x".$data['hex'];     

 

SCRIPT DE INSERT:

 

public function cadastroArqAtendimento($param1,$param2,$param3,$param4,$param5,$param6,$param7,$param8,$param9){
            $start = $this->conexao->prepare("             
                INSERT INTO HATENDIMENTOARQUIVOSANEXOS
               (CODARQUIVO,CODCOLIGADA,CODLOCAL,CODATENDIMENTO,CODCOLIGADAATENDENTE,CODATENDENTE,NOMEARQUIVO,DETALHESARQUIVO,ARQUIVO,TAMANHOARQUIVO,
               CODCOLIGADAATENDATUAL,CODATENDENTEATUAL,DATAULTIMAALTERACAO,TIPOALTERACAO,RECCREATEDBY,RECCREATEDON,RECMODIFIEDBY,RECMODIFIEDON) 
             VALUES (?, 1, ?, ?, 1, ?, ?, 'ARQUIVO ANEXO', ?, ?, 1, ?, GETDATE(), 'Adicionado', ?, GETDATE(), null, null)        
            ");        
            
            $start->bindValue(1,$param1);            
            $start->bindValue(2,$param2);            
            $start->bindValue(3,$param3);            
            $start->bindValue(4,$param4);            
            $start->bindValue(5,$param5);            
            $start->bindValue(6,$param6,PDO::PARAM_LOB);
            $start->bindValue(7,$param7);            
            $start->bindValue(8,$param8);            
            $start->bindValue(9,$param9);                
            
            
            $start->execute();
            return $start->errorCode();
        }

 

 

O PROBLEMA É QUE NÃO INSERTA NO BANCO SEMPRE ME RETORNA O ERRO NUM TRACE ASSIM :

Operand type clash: text is incompatible with image php;


SE ALGUÉM PODER ME AJUDAR, SERÁ DE GRANDE VALIA.

AGRADECIDO.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

 Share

  • Forum Statistics

    • Total Topics
      149.8k
    • Total Posts
      646.6k
×
×
  • Create New...