Skip to content

Stdlib: move_uploaded_file for VM (multipart upload reference apps) #2005

Description

@PurHur

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:webWeb / CGI / superglobalsenhancementNew feature or requestphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions