Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Rename Upload PHP File

Codes here !

Moderators: macek, egami, gesf

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");
Ezkiel
New php-forum User
New php-forum User
 
Posts: 1
Joined: Fri Jun 21, 2013 7:51 am

Re: Rename Upload PHP File

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

please read about move_uploaded_file()
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.