Upload image using the mobile phone's PHP camera

0

Personal I have a register where CNH and CRLV photos are "attached".

In order for the cell phone camera to be triggered by clicking the "select image" button I used the property below:

input type="file"  accept="image/*" capture="camera" id="foto_cnh" name="foto_cnh" 

So far, it's running 100%. The problem is when I use for CNH and CRLV:

input type="file"  accept="image/*" capture="camera" id="foto_crlv" name="foto_crlv" 

in this case the system ignores the first image (CNH) and only uploads the second one (CRLV). If I make the registration from a pc works normal for both.

Any light?

Follow my php:

$foto_cnh   = (isset($_POST['foto_cnh'])) ? $_POST['foto_cnh'] : '';

$foto_crlv  = (isset($_POST['foto_crlv'])) ? $_POST['foto_crlv'] : '';

// FAZ UPLOAD DA CNH 
if(isset($_FILES['foto_cnh']) && $_FILES['foto_cnh']['size'] > 0):  
    if(is_uploaded_file($_FILES['foto_cnh']['tmp_name'])):
        $foto_cnh = date('Y-m-d-h-i-s') . '_' . $_FILES['foto_cnh']['name'];    
        if (!move_uploaded_file($_FILES['foto_cnh']['tmp_name'], 'fotos/'.$foto_cnh)):  
            echo "Houve um erro ao gravar arquivo na pasta de destino!";  
        endif;  
    endif;  
endif;
// FIM DO UPLOAD DA CNH


// FAZ UPLOAD DA CRLV 
if(isset($_FILES['foto_crlv']) && $_FILES['foto_crlv']['size'] > 0):    
    if(is_uploaded_file($_FILES['foto_crlv']['tmp_name'])):
        $foto_crlv = date('Y-m-d-h-i-s') . '_' . $_FILES['foto_crlv']['name'];  
        if (!move_uploaded_file($_FILES['foto_crlv']['tmp_name'], 'fotos/'.$foto_crlv)):  
            echo "Houve um erro ao gravar arquivo na pasta de destino!";  
        endif;  
    endif;  
endif;
// FIM DO UPLOAD DA CRLV
    
asked by anonymous 02.10.2018 / 14:55

0 answers