Problem
#87 closed with nested $_FILES population from multipart bodies (#52), but there is no move_uploaded_file() implementation in ext/standard/ or VM builtins (repo grep is empty).
#1999 (006-FileUploadWeb) can echo $_FILES['doc']['name'] without this, but a credible upload demo needs to persist the temp part to uploads/ safely.
Goal
if (move_uploaded_file($_FILES['doc']['tmp_name'], '/var/app/uploads/doc.pdf')) {
echo 'saved';
}
works in VM + phpc serve + AOT CGI refresh path when multipart env is set.
Scope
| Piece |
Deliverable |
| VM builtin |
ext/standard/file.php or dedicated upload helper |
| Temp path policy |
Only accept paths under parser temp dir from #52 |
| Security |
Reject .., absolute escapes; document max size tie-in #77 |
| JIT |
Defer — VM + compliance PHPT first |
| AOT |
Runtime builtin or VM fallback until JIT lands |
| Tests |
test/compliance/cases/stdlib/move_uploaded_file.phpt |
Implementation hints
| Layer |
Files |
Notes |
| Parser temp files |
lib/Web/Superglobals.php |
$_FILES[..]['tmp_name'] from multipart parts |
| Builtin |
ext/standard/*.php, lib/VM.php dispatch |
Mirror Zend subset semantics |
| Capabilities |
script/capability-matrix.php |
Row for web upload apps |
| Example |
examples/006-FileUploadWeb/ |
Optional save path behind flag |
Acceptance criteria
./phpc run -r '/* synthetic $_FILES + temp — see PHPT */'
./script/ci-fast.sh --filter move_uploaded_file
phpc serve multipart POST + move_uploaded_file returns success HTML.
Verification (local / Docker only)
make docker-build-22
./script/docker-ci-local.sh --filter move_uploaded
No GitHub Actions.
Dependencies
Links
Problem
#87 closed with nested
$_FILESpopulation from multipart bodies (#52), but there is nomove_uploaded_file()implementation inext/standard/or VM builtins (repo grep is empty).#1999 (
006-FileUploadWeb) can echo$_FILES['doc']['name']without this, but a credible upload demo needs to persist the temp part touploads/safely.Goal
works in VM +
phpc serve+ AOT CGI refresh path when multipart env is set.Scope
ext/standard/file.phpor dedicated upload helper.., absolute escapes; document max size tie-in #77test/compliance/cases/stdlib/move_uploaded_file.phptImplementation hints
lib/Web/Superglobals.php$_FILES[..]['tmp_name']from multipart partsext/standard/*.php,lib/VM.phpdispatchscript/capability-matrix.phpexamples/006-FileUploadWeb/Acceptance criteria
./phpc run -r '/* synthetic $_FILES + temp — see PHPT */' ./script/ci-fast.sh --filter move_uploaded_filephpc servemultipart POST +move_uploaded_filereturns success HTML.Verification (local / Docker only)
No GitHub Actions.
Dependencies
$_FILESshapeLinks