Rename Upload PHP File

Codes here !

Moderators: macek, egami, gesf

Ezkiel
New php-forum User
New php-forum User
Posts: 1
Joined: Fri Jun 21, 2013 7:51 am

Rename Upload PHP File

Postby Ezkiel » Fri Jun 21, 2013 7:54 am

Hi everyone

I can't rename a upload file in directory and mysql (image_path), this is my code:

Code: Select all

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $arquivo = $_FILES["Image"]; $arquivo_nome = $arquivo["name"];
  $insertSQL = sprintf("INSERT INTO roman_mosaic1 (Nome, pais, Image) VALUES (%s, %s, '$arquivo_nome')",
                     
                  GetSQLValueString($_POST["Nome"], "text"),
                       GetSQLValueString($_POST["pais"], "text"));                     
  mysql_select_db($database_minha, $minha);
  $Result1 = mysql_query($insertSQL, $minha) or die(mysql_error());
set_time_limit(0);
$diretorio = "Arquivos";
$id_arquivo = "Image";
$nome_arquivo = $_FILES[$id_arquivo]["name"]; $arquivo_temporario = $_FILES[$id_arquivo]["tmp_name"];
move_uploaded_file($arquivo_temporario, "$diretorio/$nome_arquivo");

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Rename Upload PHP File

Postby johnj » Mon Jul 01, 2013 8:38 pm

please read about move_uploaded_file()


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 3 guests