I want to check if the user has selected an image for upload. What is the php script to do that after the user has clicked submit...
I tried file_exist(), but that expects a string rather than an array and it seems that only works for an absolute path. Since I don't know which folder the user is going to upload from, this doesn't work.
Can someone help?
Take a look at the $_FILES
superglobal .
Tizag Tutorial: http://www.tizag.com/phpT/fileupload.php
If you do a print_r($_FILES)
, you will see everything you need.
You need to use the super global variable $_FILES
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.