1

Not having any luck with my other thread with specific code so if I can I'd like to ask how people would go about getting this to work.

I have an page where my client edits details of a property displayed on a property list, say they edit text and don't add any images to this property.

HTML form works fine, I'm just looking at the php.

Example:

If files selected then run this script as an include
If no files selected then exit

Something like this...

if($_FILES['files']['name']!="")
 {
 Do this
 }
  else
{
exit();
}

I'm going mental trying to figure this out so any help or suggestions would be great. I have tried a few variations and variations on top of those variations and nothing seems to work so far.

Cheers

Bjorn
  • 285
  • 3
  • 6
  • 19

1 Answers1

4

Use isset() orempty() constructs. (For more information read PHP doc)

if(!empty($_FILES['files']['name']))
 {
  //
 }
xdazz
  • 158,678
  • 38
  • 247
  • 274
KV Prajapati
  • 93,659
  • 19
  • 148
  • 186
  • LEGEND! worked perfectly. Thanks AVD. @xdazz cheers for the edit did see the `$_` missing ;) – Bjorn Sep 12 '12 at 04:18