PHP- Upado file does not go pro directory defined

0
$arquivocom = $_FILES['submetidocom']['name'];
    $diretoriocom = "C:/Users/NEWGRID/Documents/uploadcom/";
    move_uploaded_file($_FILES['submetidocom']['tmp_name'], $diretoriocom.$arquivocom);
    if (file_exists($arquivocom)){  
         echo"<script language='javascript' type='text/javascript'>alert('Arquivo 2 já existente, por favor renomeio-o e tente novamente');</script>";

    }else{
         echo"<script language='javascript' type='text/javascript'>alert('Upload 2 feito com sucesso!');</script>"; 
    }

HTML

                 <input type="hidden" name="MAX_FILE_SIZE" value="30000">            
                <input type="file" class="form-control-file" name="submetidocom" value="<?php echo $submetidocom; ?>" id="submetidocom" required="" autofocus="">
          </div>
    
asked by anonymous 20.03.2018 / 14:38

1 answer

0

Personal thank you very much for the help, but I managed to solve it, it happens that I was putting the move_uploaded_file before the condition and should be put later. It is now working correctly.

    
20.03.2018 / 19:45