0
I have the following function to send multiple images:
//Diretório onde a imagem será gravada temporariamente
$dirToSave = 'assets/uploads/'.$pasta.'/'.$tipo.'/';
if(!is_dir($dirToSave)){
echo "noa tem";
mkdir($dirToSave, 0777, TRUE);
chmod($dirToSave, 0777);
}
//Limite do tamanho máximo que a imagem deve ter
$length = 5242880; //5 MB por arquivo
//Extensões permitidas para os arquivos
$fileExtension = array( 'jpg', 'jpeg', 'png' );
//Inicializa os parametros necessários para upload da imagem
$this->files->initialize( $dirToSave, $length, $fileExtension );
//Verifica se alguma imagem foi selecionada
$image = isset( $_FILES[ $campo ] ) ? $_FILES[ $campo ] : null;
if( !is_null( $image ) ) {
//Seta o arquivo para upload
$this->files->setFile( $image );
//Processa o arquivo e recebe o retorno
$upload = $this->files->processMultFiles($campo);
//Verifica retornbou algum código, se sim, ocorreu algum erro no upload
isset( $upload['code'] ) ? 'mensagem de erro' : null;
foreach($upload as $valor){
$fotos['int_id'] = $cod;
$fotos['inf_tipo'] = $tipo;
$fotos['inf_imagem'] = str_replace('assets/uploads/'.$pasta.'/'.$tipo.'/', "", $valor['file']);
if(preg_match('%assets/uploads%', $fotos['inf_imagem'])==true){
} else {
$this->adicionar('interno_fotos', $fotos);
}
}
}
However, I use this system on LOCALHOST, and need to send the photos to a SERVER. How can I send to the server instead of sending to a localhost?
If the user has FTP access to the server, he could not then send the PHP source to the server, via FTP client, and then do there the same thing he did on localhost, without any additional implementation?
– C. Bohok
In this case he made it clear that he uses the localhost system and would like to save the images on an external server, this was the problem.
– Luno de Souza
@C.Bohok No, the idea is just an external upload, and using localhost, because these are systems installed on several other desktops that need to run on localhost, because they use external components (biometric reader) and cannot be 100% online.
– Sr. André Baill