how can i check with php tht wheather the file field is set
Moderator: General Moderators
- itsmani1
- Forum Regular
- Posts: 791
- Joined: Mon Sep 29, 2003 2:26 am
- Location: Islamabad Pakistan
- Contact:
how can i check with php tht wheather the file field is set
i want to check wheather the file field is set or not? i tried isset($_[file]) but its not worth while.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Code: Select all
if (!empty($_FILES['fieldname']['tmp_name'])) {
}I quite often use the following code as well, just to make sure that there have been no errors
Code: Select all
if (!empty($_FILES['fieldname']['tmp_name'])) {
if($_FILES['fieldname']['error']==0){
// upload file
}
}