Error Message - Uploading Files

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
AaaDee
New php-forum User
New php-forum User
Posts: 25
Joined: Mon Jun 24, 2002 1:10 am
Location: Huddersfield
Contact:

Error Message - Uploading Files

Postby AaaDee » Wed Jul 17, 2002 2:18 am

147 switch($task)
148
149 {
150
151 case 'upload':
152 upload($the_file);
153 break;
154 default:
155 form();
156
157 }

Why is it displaying THIS error????

Warning: Undefined variable: task in c:\dev\intranet\news\easy-uploads.php on line 147

It works perfect but it obviosuly doesnt look right with an error msg. i try taking it out, the whole upload doesnt work!

Cheers

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: Error Message - Uploading Files

Postby WiZARD » Wed Jul 17, 2002 6:44 am

AaaDee wrote:147 switch($task)
148
149 {
150
151 case 'upload':
152 upload($the_file);
153 break;
154 default:
155 form();
156
157 }

Why is it displaying THIS error????

Warning: Undefined variable: task in c:\dev\intranet\news\easy-uploads.php on line 147

It works perfect but it obviosuly doesnt look right with an error msg. i try taking it out, the whole upload doesnt work!

Cheers


Hi Adam!
I think that you using last version of PHP... Correct?
In a last version of PHP you have a problem with unsetting variables, try to using next:

Code: Select all

if (isset($task)) {$task='upload'}

switch($task)
{
case 'upload':
upload($the_file);
break;
default:
form();
}

And once more, if you no use more variants use if .... else


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 2 guests