Sinisterly
[*FIXED*] Issue with in_array() [strange] - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: [*FIXED*] Issue with in_array() [strange] (/Thread-FIXED-Issue-with-in-array-strange)

Pages: 1 2 3 4 5


[*FIXED*] Issue with in_array() [strange] - hellomen - 10-28-2013

Hi there!
@Illusion and I have been working on fixing this but we can't get it fixed for some reason
the only line that messes with me is this line:
PHP Code:
if (in_array(strtolower($_FILES['image']['type']),$extensions)){ #stuff }else{ echo('Please upload a correct image using one of the following extention(s): <strong>'."$newStrExtentions".'</strong>'); }
the #stuff is used as connection with the database

above this if statement I've got these codes:
PHP Code:
$extentions = array('image/jpg','image/jpeg','image/gif');

PHP Code:
if ($_FILES['image']['error']){ $errors = array( 0=>"There is no error, the file uploaded with success", 1=>"The uploaded file exceeds the upload_max_filesize directive in php.ini", 2=>"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form", 3=>"The uploaded file was only partially uploaded", 4=>"No file was uploaded", 6=>"Missing a temporary folder" ); die("<b>There was an error:</b> <br/>".$errors[$_FILES['image']['error']]); }
-thanks to illusion

PHP Code:
echo('Debugging:<br/>File(s): '); var_dump($_FILES); echo('<br/>Extention(s): '); var_dump($extentions); echo('<br/>');
- thanks to illusion to check never thought about this...

the error:
Code:
Warning: in_array() expects parameter 2 to be array, null given in /home/u220540669/public_html/index.php on line 40

out put of the debugging:
Code:
File(s): array(1) { ["image"]=> array(5) { ["name"]=> string(34) "mta-screen_2013-03-28_12-15-33.png" ["type"]=> string(9) "image/png" ["tmp_name"]=> string(14) "/tmp/phpO6nI5F" ["error"]=> int(0) ["size"]=> int(939906) } } Extention(s): array(3) { [0]=> string(9) "image/jpg" [1]=> string(10) "image/jpeg" [2]=> string(9) "image/gif" }

I hope some one could help me out of this strange issue(s) because it's really needed
Thanks for taking your time looking at this forsure and if you could help me please do it.

Regards,
hellomen


[*FIXED*] Issue with in_array() [strange] - hellomen - 10-28-2013

Hi there!
@Illusion and I have been working on fixing this but we can't get it fixed for some reason
the only line that messes with me is this line:
PHP Code:
if (in_array(strtolower($_FILES['image']['type']),$extensions)){ #stuff }else{ echo('Please upload a correct image using one of the following extention(s): <strong>'."$newStrExtentions".'</strong>'); }
the #stuff is used as connection with the database

above this if statement I've got these codes:
PHP Code:
$extentions = array('image/jpg','image/jpeg','image/gif');

PHP Code:
if ($_FILES['image']['error']){ $errors = array( 0=>"There is no error, the file uploaded with success", 1=>"The uploaded file exceeds the upload_max_filesize directive in php.ini", 2=>"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form", 3=>"The uploaded file was only partially uploaded", 4=>"No file was uploaded", 6=>"Missing a temporary folder" ); die("<b>There was an error:</b> <br/>".$errors[$_FILES['image']['error']]); }
-thanks to illusion

PHP Code:
echo('Debugging:<br/>File(s): '); var_dump($_FILES); echo('<br/>Extention(s): '); var_dump($extentions); echo('<br/>');
- thanks to illusion to check never thought about this...

the error:
Code:
Warning: in_array() expects parameter 2 to be array, null given in /home/u220540669/public_html/index.php on line 40

out put of the debugging:
Code:
File(s): array(1) { ["image"]=> array(5) { ["name"]=> string(34) "mta-screen_2013-03-28_12-15-33.png" ["type"]=> string(9) "image/png" ["tmp_name"]=> string(14) "/tmp/phpO6nI5F" ["error"]=> int(0) ["size"]=> int(939906) } } Extention(s): array(3) { [0]=> string(9) "image/jpg" [1]=> string(10) "image/jpeg" [2]=> string(9) "image/gif" }

I hope some one could help me out of this strange issue(s) because it's really needed
Thanks for taking your time looking at this forsure and if you could help me please do it.

Regards,
hellomen


[*FIXED*] Issue with in_array() [strange] - hellomen - 10-28-2013

Hi there!
@Illusion and I have been working on fixing this but we can't get it fixed for some reason
the only line that messes with me is this line:
PHP Code:
if (in_array(strtolower($_FILES['image']['type']),$extensions)){ #stuff }else{ echo('Please upload a correct image using one of the following extention(s): <strong>'."$newStrExtentions".'</strong>'); }
the #stuff is used as connection with the database

above this if statement I've got these codes:
PHP Code:
$extentions = array('image/jpg','image/jpeg','image/gif');

PHP Code:
if ($_FILES['image']['error']){ $errors = array( 0=>"There is no error, the file uploaded with success", 1=>"The uploaded file exceeds the upload_max_filesize directive in php.ini", 2=>"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form", 3=>"The uploaded file was only partially uploaded", 4=>"No file was uploaded", 6=>"Missing a temporary folder" ); die("<b>There was an error:</b> <br/>".$errors[$_FILES['image']['error']]); }
-thanks to illusion

PHP Code:
echo('Debugging:<br/>File(s): '); var_dump($_FILES); echo('<br/>Extention(s): '); var_dump($extentions); echo('<br/>');
- thanks to illusion to check never thought about this...

the error:
Code:
Warning: in_array() expects parameter 2 to be array, null given in /home/u220540669/public_html/index.php on line 40

out put of the debugging:
Code:
File(s): array(1) { ["image"]=> array(5) { ["name"]=> string(34) "mta-screen_2013-03-28_12-15-33.png" ["type"]=> string(9) "image/png" ["tmp_name"]=> string(14) "/tmp/phpO6nI5F" ["error"]=> int(0) ["size"]=> int(939906) } } Extention(s): array(3) { [0]=> string(9) "image/jpg" [1]=> string(10) "image/jpeg" [2]=> string(9) "image/gif" }

I hope some one could help me out of this strange issue(s) because it's really needed
Thanks for taking your time looking at this forsure and if you could help me please do it.

Regards,
hellomen


[*FIXED*] Issue with in_array() [strange] - hellomen - 10-28-2013

Hi there!
@Illusion and I have been working on fixing this but we can't get it fixed for some reason
the only line that messes with me is this line:
PHP Code:
if (in_array(strtolower($_FILES['image']['type']),$extensions)){ #stuff }else{ echo('Please upload a correct image using one of the following extention(s): <strong>'."$newStrExtentions".'</strong>'); }
the #stuff is used as connection with the database

above this if statement I've got these codes:
PHP Code:
$extentions = array('image/jpg','image/jpeg','image/gif');

PHP Code:
if ($_FILES['image']['error']){ $errors = array( 0=>"There is no error, the file uploaded with success", 1=>"The uploaded file exceeds the upload_max_filesize directive in php.ini", 2=>"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form", 3=>"The uploaded file was only partially uploaded", 4=>"No file was uploaded", 6=>"Missing a temporary folder" ); die("<b>There was an error:</b> <br/>".$errors[$_FILES['image']['error']]); }
-thanks to illusion

PHP Code:
echo('Debugging:<br/>File(s): '); var_dump($_FILES); echo('<br/>Extention(s): '); var_dump($extentions); echo('<br/>');
- thanks to illusion to check never thought about this...

the error:
Code:
Warning: in_array() expects parameter 2 to be array, null given in /home/u220540669/public_html/index.php on line 40

out put of the debugging:
Code:
File(s): array(1) { ["image"]=> array(5) { ["name"]=> string(34) "mta-screen_2013-03-28_12-15-33.png" ["type"]=> string(9) "image/png" ["tmp_name"]=> string(14) "/tmp/phpO6nI5F" ["error"]=> int(0) ["size"]=> int(939906) } } Extention(s): array(3) { [0]=> string(9) "image/jpg" [1]=> string(10) "image/jpeg" [2]=> string(9) "image/gif" }

I hope some one could help me out of this strange issue(s) because it's really needed
Thanks for taking your time looking at this forsure and if you could help me please do it.

Regards,
hellomen


[*FIXED*] Issue with in_array() [strange] - hellomen - 10-28-2013

Hi there!
@Illusion and I have been working on fixing this but we can't get it fixed for some reason
the only line that messes with me is this line:
PHP Code:
if (in_array(strtolower($_FILES['image']['type']),$extensions)){ #stuff }else{ echo('Please upload a correct image using one of the following extention(s): <strong>'."$newStrExtentions".'</strong>'); }
the #stuff is used as connection with the database

above this if statement I've got these codes:
PHP Code:
$extentions = array('image/jpg','image/jpeg','image/gif');

PHP Code:
if ($_FILES['image']['error']){ $errors = array( 0=>"There is no error, the file uploaded with success", 1=>"The uploaded file exceeds the upload_max_filesize directive in php.ini", 2=>"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form", 3=>"The uploaded file was only partially uploaded", 4=>"No file was uploaded", 6=>"Missing a temporary folder" ); die("<b>There was an error:</b> <br/>".$errors[$_FILES['image']['error']]); }
-thanks to illusion

PHP Code:
echo('Debugging:<br/>File(s): '); var_dump($_FILES); echo('<br/>Extention(s): '); var_dump($extentions); echo('<br/>');
- thanks to illusion to check never thought about this...

the error:
Code:
Warning: in_array() expects parameter 2 to be array, null given in /home/u220540669/public_html/index.php on line 40

out put of the debugging:
Code:
File(s): array(1) { ["image"]=> array(5) { ["name"]=> string(34) "mta-screen_2013-03-28_12-15-33.png" ["type"]=> string(9) "image/png" ["tmp_name"]=> string(14) "/tmp/phpO6nI5F" ["error"]=> int(0) ["size"]=> int(939906) } } Extention(s): array(3) { [0]=> string(9) "image/jpg" [1]=> string(10) "image/jpeg" [2]=> string(9) "image/gif" }

I hope some one could help me out of this strange issue(s) because it's really needed
Thanks for taking your time looking at this forsure and if you could help me please do it.

Regards,
hellomen


RE: Issue with in_array() [strange] - 1llusion - 10-28-2013

Ha! I found the error! You have a typo in one of the two variables Smile
Have a look yourself:
$extensions
$extentions - missing a S


RE: Issue with in_array() [strange] - 1llusion - 10-28-2013

Ha! I found the error! You have a typo in one of the two variables Smile
Have a look yourself:
$extensions
$extentions - missing a S


RE: Issue with in_array() [strange] - 1llusion - 10-28-2013

Ha! I found the error! You have a typo in one of the two variables Smile
Have a look yourself:
$extensions
$extentions - missing a S


RE: Issue with in_array() [strange] - 1llusion - 10-28-2013

Ha! I found the error! You have a typo in one of the two variables Smile
Have a look yourself:
$extensions
$extentions - missing a S


RE: Issue with in_array() [strange] - 1llusion - 10-28-2013

Ha! I found the error! You have a typo in one of the two variables Smile
Have a look yourself:
$extensions
$extentions - missing a S