This topic is locked

Picture uploaded not rename in the folder

1/12/2011 12:14:54 PM
PHPRunner General questions
N
nico2bret author

hi all of you !
I have a question regarding the files uploaded with PHP runner. I read carefully the explanation in the manual and made it work.
Actually when I am uploading an image/picture on Jpg format the file name is well transformed in the database but the file loaded on the server keeps the same name as the one shown before download is completed.
find attached the code entered in the function Before add.
Quote

function BeforeAdd(&$values,&$message,$inline)

{
$filesize=$_FILES["file_filemime"]["size"];

if($filesize>6000000 or $filesize<100000)

{

$values["filemine"]="";

$message = "<div class=message><<< la taille de votre image doit être comprise entre 100 ko et 6 Mo max >>></div>";

return false;

}
global $files_move;

$today=date("j.m.Y-H_i_s");

$nom= $values["id_piges"]."Pige".$values["id_pigiste"]."_pigistedu".$today;

foreach( $files_move as $key=>$val)

{
if($val[0]==$_FILES["file_filemime"]["tmp_name"])
// $files_move[$key][1] = "files/photos/".$nom.".jpg";

}

$values["filemime"] = $nom.".jpg";
return true;

}
I am wondering why the file saved on teh server folder is not renamed while the name in the database is well transformed
Looking for your idea or suggestion..

Sergey Kornilov admin 1/12/2011

As far as I understand the code that actually renames file is commented out in your code. You need to uncomment it first.
If you use PHPRunner 5.3 I would suggest to take another look at this article:

http://xlinesoft.com/phprunner/docs/rename_uploaded_file.htm
The proper way to refer to file size and name is respectively

$_FILES["value_filemime_1"]["size"] and $_FILES["value_filemime_1"]["tmp_name"]
Hope this helps.