質問

if($_SERVER['REQUEST_METHOD'] == 'POST') {
        $image = $_FILES["image"]["name"];

        echo "File: " . $image;
    }

the echo is "File :" all the time

        <form action="" method="post" id="formAddProperty">
            <div id="propertyImage">
                <label for="image">Upload image:</label>
                <input type="file" name="image">
            </div>

            <input type="submit" value="Add Property" id="propertySubmit">
        </form>

I'm running a local server via mamp, is than an issue? The purpose is to get file name than its extension (which is not shown in this example).

役に立ちましたか?

解決

You are missing

enctype="multipart/form-data"

in the form

<form action="" method="post" id="formAddProperty" enctype="multipart/form-data">
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top