Forum Moderators: coopster

Message Too Old, No Replies

Uploading a file that exceeds limit

How can i hide the warning msg?

         

asantos

1:02 am on Jun 14, 2006 (gmt 0)

10+ Year Member



When i upload files bigger than the upload_max_filesize limit, i get this warning msg:

Warning: upload_max_filesize of 2097152 bytes exceeded - file [file=picture.jpg] not saved in Unknown on line 0

This is the uploader:


<form name="frmUpload" action="handler.php" method="POST" enctype="multipart/form-data">
<input type="file" id="file" class="file" name="file" />
<input type="submit" />
</form>

How can I HIDE the warning message?
I have this setting:
error_reporting(E_ALL ^ (E_NOTICE ¦ E_WARNING));

eelixduppy

1:18 am on Jun 14, 2006 (gmt 0)



Change it to error_reporting(0);

asantos

1:22 am on Jun 14, 2006 (gmt 0)

10+ Year Member



doesnt work neither.

asantos

1:50 am on Jun 14, 2006 (gmt 0)

10+ Year Member



This code still throws the WARNING message.

<?
error_reporting(0);
echo '<pre>';
print_r($_FILES);
echo '</pre>';
?>
<html>
<head>
</head>
<body>
<form name="frmUpload" action="test.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
<input type="file" id="file" class="file" name="file" />
<input type="submit" />
</form>
</body>
</html>

eelixduppy

1:57 am on Jun 14, 2006 (gmt 0)



You have to add error_reporting(0); to test.php, not the top of the form

asantos

2:13 am on Jun 14, 2006 (gmt 0)

10+ Year Member



The form is test.php ;) the action of the form calls itself.

eelixduppy

2:14 am on Jun 14, 2006 (gmt 0)



Then add error_reporting(0); to the top of test.php..all the way at the top outside of functions;)

asantos

2:22 am on Jun 14, 2006 (gmt 0)

10+ Year Member



It IS at the top, there's nothing above it. That's whats weird. I dont know why the error still shows up.

asantos

2:25 am on Jun 14, 2006 (gmt 0)

10+ Year Member



Actually, the only way it works is if I modify this in the php.ini:

error_reporting = E_ALL ^ (E_NOTICE ¦ E_WARNING)

That on my personal server. But i dont have access to the php.ini where i will host the script. Shouldnt this overwrite the php.ini settings?
<?php
error_reporting(E_ALL ^ (E_NOTICE ¦ E_WARNING));
?>

eelixduppy

2:25 am on Jun 14, 2006 (gmt 0)



Try ini_set("display_errors","FALSE");

asantos

2:32 am on Jun 14, 2006 (gmt 0)

10+ Year Member



Same warning message appears.
I even tried with:

ini_set('display_errors','FALSE');
ini_set('error_reporting','E_ALL ^ (E_NOTICE ¦ E_WARNING)');

asantos

2:33 am on Jun 14, 2006 (gmt 0)

10+ Year Member



BTW, the warning ONLY shows up when the $_FILE['file']['error'] equals 1. When error = 4 there's no message.