470,855 Members | 1,200 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

Getimagesize ( ) Error message Please Help!

What is with this error message?????? First part validates, second part
fails...

getimagesize (filename...) failed to open stream: No such file or directory

} elseif ($photo) {

$ext = strtolower(substr($photo, -3));

if ($ext == "peg") { $ext = "jpg"; }

if ($ext != "gif" && $ext != "jpg" && $ext != "jpeg" && $ext != "bmp" )
{

$focus = "photo";
$msg2 = "Please provide a valid gif, jpeg, or bmp photo or do not
attach one.";

} else {

$size = getimagesize($photo);

if ($size > 25000) {

$msg2 = "Photo must be smaller than 25k.";
}}}
Jul 17 '05 #1
1 3437
Philip D Heady wrote:

What is with this error message?????? First part validates, second part
fails...

getimagesize (filename...) failed to open stream: No such file or directory

} elseif ($photo) {

$ext = strtolower(substr($photo, -3));

if ($ext == "peg") { $ext = "jpg"; }

if ($ext != "gif" && $ext != "jpg" && $ext != "jpeg" && $ext != "bmp" )
{

$focus = "photo";
$msg2 = "Please provide a valid gif, jpeg, or bmp photo or do not
attach one.";

} else {

$size = getimagesize($photo);

if ($size > 25000) {

$msg2 = "Photo must be smaller than 25k.";

}}}


What is $photo? It should be a URL or a path to a file (either absolute or
relative). However, if you get it working, you'll run into a problem with the
next line. First, getimagesize() returns an array. Second, none of the
elements in the array relate to filesize. They relate to it's type, height and
width.

http://ca.php.net/manual/en/function.getimagesize.php

You should read about filesize():
http://ca.php.net/manual/en/function.filesize.php
Or if this is a file the user has uploaded, try using:
$_FILES['photo']['size']

http://ca.php.net/features.file-upload

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by rcb845 | last post: by
1 post views Thread by Lucid77 | last post: by
1 post views Thread by sree | last post: by
1 post views Thread by lawrence k | last post: by
7 posts views Thread by Ja NE | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.