This topic is locked

Upload file rename

8/17/2015 9:30:18 AM
PHPRunner General questions
T
tubisan author

detail Rename physical name of uploaded file ( mastertable_code + detailtable_file_code + extension )
Master Table :

------------------

fid int 11

code varchar 100
fid code

----------------------------

1 FR.01.00

2 PR.02.03

3 GF.01.00
Detail Table :

-----------------------

did int 11

fid int 11

file varchar 500

file_code varchar 100
did fid file file_code

------------------------------------------------------

1 1 [size="3"]FR.01.00-1545.docx[/size] 1545

2 1 [size="3"]FR.01.00-1698.pdf[/size] 1698

Sergey Kornilov admin 8/17/2015

It's hard to understand what is the actual question here.

T
tubisan author 8/18/2015



It's hard to understand what is the actual question here.


I'm sending the picture in the attachment.

the physical name of the file when I upload the file will change.


-----------------------------

How do I edit this code

----------------------------
$fileArray = my_json_decode($values["file"]);

for($i = 0; $i < count($fileArray); $i++)
{
$fileName = $fileArray[$i]["name"];
$newFileName = "files/".$values["code"].$values["file_code"].$i.".jpg";
rename($fileName, getabspath($newFileName));
$fileArray[$i]["name"] = $newFileName;
}

$values["fieldname"] = my_json_encode($fileArray);