PHP $_FILES['file']['tmp_name']: How to preserve filename and extension?

后端 未结 6 1142
谎友^
谎友^ 2020-12-09 16:25

I am trying to upload a doc file from a form and send it to email. I am using

$_FILES[\'file\'][\'tmp_name\'];

The problem is, it is retur

6条回答
  •  旧巷少年郎
    2020-12-09 16:53

    $_FILES['file']['tmp_name']; will contain the temporary file name of the file on the server. This is just a placeholder on your server until you process the file

    $_FILES['file']['name']; contains the original name of the uploaded file from the user's computer.

提交回复
热议问题