Is to bizzare.
Why mix Numeric and Non-Numeric Indices?!
And if you look up the list function: http://us3.php.net/manual/en/function.list.php
We find
[QUOTE]list() only works on numerical arrays and assumes the numerical indices start at 0.
[/quote]
Okay, I didn’t know that.
I seldom use list. Seems fragile to rely on argument order.
Agreed!!
Just do:
$imageDetails = getImageSize('icon-valid.gif');
if ($imageDetails)
{
echo 'Type: ' . $imageDetails['mime'] . "\
";
}
I don’t follow your code. I was just looking for a way to simplify my code and hopefully roll “MIME” into the LIST().
Anyways.
And I’d lose the @ as well. If there is a problem with the file name itself then you should probably deal with it instead of hiding it.
I have been fighting with getImageSize() since last night and have had a few people confirm it is buggy
Last night my code looked like this…
$tempName = $_FILES['userPhoto']['tmp_name'];
// Determine if Image was uploaded via HTTP POST.
if (is_uploaded_file($tempName)){
// File uploaded via HTTP.
// Get of Image Details.
$imageDetails = getImageSize($tempName);
// Get Image Type
$imageType = $imageDetails['mime'];
echo '<p>var_dump($imageDetails) = ' . var_dump($imageDetails) . '</p>';
echo '<p>var_dump($imageType) = ' . var_dump($imageType) . '</p>';
Whenever I tried to upload “test.php.jpg” I got this error…
Notice: getimagesize() [function.getimagesize]: Read error! in /Users/user1/Documents/DEV/++htdocs/05_Debbie/members/upload.php on line 56
…where Line 56 strat with $imageDetails = getImageSize($tempName);
The var_dump() showed boolean false but I was still getting that error.
After playing around with other files, I finally got this same file working with no error.
This error comes and goes with no rhyme or reason…
So I switched to the new format I have now because it always seems to work, but I added the ampersand @ just in case!!
If you can explain why I was getting these random, unexplainable errors, then maybe I’d be willing to lose the @ otherwise I think it is safer to leave it?!
Thanks,
Debbie