I would like to upload an image file using the move_uploaded_file function.
Even if you check this site,
move_uploaded_file($_FILES['image']['tmp_name'], './images/'.$image);
I don't know what to put in ['image']['tmp_name']
in the .
I am sorry to trouble you, but I appreciate your cooperation.
For move_uploaded_file
, specify をWhich files 移動 and どこWhere to move する as per common copy operations.
move_uploaded_file(string$from, string$to):bool
The $_FILES['image']['tmp_name']
used in the referenced article is a special variable that $_FILES
uses to upload files in the POST method, and the ['image']
part must match the <input type="file">code;
of the form.
<form method="post" enctype="multipart/form-data">
<p>Upload Images</p>
<input type="file" name="image">
<button><input type="submit" name="upload" value="send">/button>
</form>
PHP:Uploading by POST Method - Manual
<!--Enctype, the encoding method for data, must be as follows -->
<form enctype="multipart/form-data" action="__URL__" method="POST">
<!--MAX_FILE_SIZE must be before the "file" input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000"/>
<!-- The value of the name attribute of the input element is the key to the $_FILES array -->
Upload this file: <input name="userfile" type="file"/>
<input type="submit" value="send file"/>
</form>
Note that this assumes that you use userfile as the name of the upload file, as used in the script in the example above. It can actually be any name.
$_FILES['userfile']['tmp_name']
The name of the temporary file where the uploaded file is stored on the server.
© 2024 OneMinuteCode. All rights reserved.