简体   繁体   中英

concatenation php variable in the path of file upload

$i = 3292;

move_uploaded_file($_FILES['doc_path']['tmp_name'], '../../../../uploads/documents/'.$i.'/'.$photograph);

move_uploaded_file($_FILES['doc_path']['tmp_name'], '../../../../uploads/documents/3292/'.$photograph);

What is the problem in the above code. concatenation is also correct but when i use $i static it works fine.Please help

Store path in one variable and use it.

$i = 3292;
$path = '../../../../uploads/documents/'.$i.'/'.$photograph;

move_uploaded_file($_FILES['doc_path']['tmp_name'], $path);

move_uploaded_file($_FILES['doc_path']['tmp_name'], '../../../../uploads/documents/3292/'.$photograph);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM