Reply to Help with Image/$_FILES Handling please

Your name:

Reply:


Posted by skulkrinbait@googlemail.com on 11/15/07 11:46

I've a HTML form that allows a user to specify the location to upload
a file from:

<p><label for = 'file'>Upload Graphics : <input type='file'
name='imagefile' /></label></p>

I then want to check if the user entered something or not as this
isn't mandatory. Here's an excerpt of the relavent code:

if (isset($_POST['submit']))
{
if (isset($_FILES['imagefile']))
{
if ($_FILES['imagefile']['type'] == "image/gif")
{
copy ($_FILES['imagefile']['tmp_name'],
"images/".$_FILES['imagefile']['name'])
or die ("Could not copy");

The problem is the line: if (isset($_FILES['imagefile'])) isn't
doing what I expect it to do, it is always returning true and
executing the code in the if construct.

How can I solve this issue so that if the user isn't submitting
anything to be uploaded that it doesn't execute that code and vice
versa?

Thanks.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация