gpt-3.5-turbo-0613· openai
Suzhen/CodeChat
Can you create web page in php 1.upload and store image file using PHP 2.Display image…
- User
Can you create web page in php 1.upload and store image file using PHP
2.Display image file using PHP
3.updated image file using PHP. 4.delete image file using PHP.
- Assistant
Yes, I can help you create a web page in PHP that can perform the mentioned tasks - uploading and storing image files, displaying image files, updating image files, and deleting image files.
Here's an example code to achieve this:
- Upload and Store Image File using PHP:
<html> <body> <form action="" method="POST" enctype="multipart/form-data"> <input type="file" name="image" /> <input type="submit" name="upload" value="Upload" /> </form> </body> </html> <?php if(isset($_POST['upload'])){ $file_name = $_FILES['image']['name']; $file_tmp = $_FILES['image']['tmp_name']; $file_path = "uploads/" . $file_name; if(move_uploaded_file($file_tmp, $file_path)){ echo "Image successfully uploaded and stored."; }else{ echo "Error uploading image."; } } ?>