0

I would like to allow user to only upload one file at a time using the flash uploader interface. I found around here a link to a hack allowing to generate an error message when more than one file is selected but that's not what I want. I would like to only take the first file into consideration and just ignore the other files.

Would it be possible?

1 Answer 1

0

You can just grab the first file in the $_FILES array.

if ($_FILES) { return $FILES[0]; }

4
  • Thank you Rachel, that seems nice. Can you tell me in which file I should put this? Commented Nov 19, 2012 at 1:58
  • I had a good look and I definitely don't know where to put this bit of code. I'm inside media.php and this doesn't fit anywhere I can think of. Thank you for your help Commented Nov 19, 2012 at 2:49
  • Where is your code to process the post results of your upload form? Commented Nov 19, 2012 at 13:48
  • I don't use any specific code.It's Wordpress native code so I believe it's "wp-includes/media.php". The hack I found is useless so I just got rid of it. Thank you Rachel Commented Nov 19, 2012 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.