Ver Mensaje Individual
  #13 (permalink)  
Antiguo 04/07/2012, 12:59
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: Renama: Intercambiar nombres de jpg

Viendo tu otro tema que acabo de unir con este, lo que debes de hacer en ese caso creo es copiar la imagen a un nombre temporal, y luego hacer el rename, por ejemplo:
Código PHP:
Ver original
  1. function exchangeFiles($file1, $file2) {
  2.        if (!(file_exists($file1) && file_exists($file2)) {
  3.               throw new Exception('no existe uno de los dos archivos');
  4.        }
  5.  
  6.        $temp = uniqid();
  7.        copy($file1, $temp); // copiar a un temporal
  8.        rename($file2, $file1); // renombrar file2 en file1
  9.        rename($temp, $file2); // renombrar temporal a file2
  10. }

Saludos.