0
I have the following problem: when I submit a form containing photographs the error described in the title appears. If you only upload a photo, it will no longer appear. But even if you make a mistake, it will save the images in the database. Can anyone tell me the origin of this error? upload code:
UPLOAD IMAGES
if (isset($_POST['enviar'])) {
    // INFO DAS IMAGENS
    $file=$_FILES['img'];
    $numfile=count(array_filter($file['name']));
    //PAsta para onde vão os arquivos
    $folder='fotografias';
    //tipos de ficheiros
    $extensoes= array('image/jpeg', 'image/png', 'image/gif');
    $maxsize=1024*1024*5;
    //mensagens
    $msg=array();
    $errormsg=array(
        1=> 'O arquivo enviado excede o limite definido na diretiva upload_max_filesize do php.ini',
        2=> 'O arquivo excede o limite definido em MAX_FILE_SIZE no formulário HTML.',
        3=> 'O upload do arquivo foi feito parcialmente.',
        4=> 'Nenhum arquivo foi enviado.'
        );
    if ($numfile<=0)
        echo "Selecione pelo menos uma imagem!";
    else{
        for ($i=0; $i < $numfile; $i++) { 
            $name =$file['name'][$i];
            $type =$file['type'][$i];
            $size =$file['size'][$i];
            $error=$file['error'][$i];
            $tmp  =$file['tmp_name'][$i];
            $extensao=@end(explode('.',$name));
            $novonome[$i]=microtime().".$extensao";
            if($error !=0)
                $msg[]="<b>$name:</b>".$errormsg[$error];
            else if (!in_array($type, $extensoes))
                $msg[]="<b>$name:</b> Erro! Imagem nao suportada!";
            else if ($size>$maxsize)
                $msg[]="<b>$name:</b> Erro! Imagem ultrapassa o limite de 5Mb!";
            else{
                if (move_uploaded_file($tmp, $folder."/".$novonome[$i]))
                    $msg[]="<b>$name:</b> Upload realizado com sucesso";
                else
                    $msg[]="<b>$name:</b> Ocorreu um erro!";
            }  
            }
    }
}
$um=$novonome[0];
$dois=$novonome[1];
$tres=$novonome[2];
$quatro=$novonome[3];
$cinco=$novonome[4];
Insert function
inserir(array("categoria","marca","modelo","ano","horas","img1","img2","img3","img4","img5"), array($categoria,$marca,$modelo,$ano,$horas,$um,$dois,$tres,$quatro,$cinco),"artigos");
Two errors arise:
Error 1
Warning: move_uploaded_file(photographs/0.95092900 1449161528.jpg): failed to open stream: No such file or directory in C: wamp www dtcr admin proc_inserir.php on line 65
Erro2
Warning: move_uploaded_file(): Unable to move 'C: wamp tmp php6409.tmp' to 'fotografias/0.95092900 1449161528.jpg' in C: wamp www dtcr admin proc_inserir.php on line 65
Line 65 is the one containing the following code:
if (move_uploaded_file($tmp, $folder."/".$novonome[$i]))
						
Try using absolute paths in the upload. How
C:\fotografias\caminho\do\arquivo.jpg– StillBuggin
Put a bar
/in front offotografiasand say what you have returned.– Edilson