PHP can't upload file from HTML form

后端 未结 2 1245
抹茶落季
抹茶落季 2021-01-22 13:33

This is how I handle my form:

        # Create the message
        # ----------------------------------------------------------------
        $name = $_POST[\'na         


        
2条回答
  •  隐瞒了意图╮
    2021-01-22 14:34

    Your form needs to have the appropriate enctype attribute set, ie

    Update

    A couple of suggestions...

    1. Check the file type and do any other general validation before you move the uploaded file. That should be your last step.
    2. Can't remember exactly right now but I don't think you'll get anything useful (or at all) in the $_POST['file'] value. Use the $_FILES array for all uploaded file data.

提交回复
热议问题