Re: .jpg/.gif extension problem!

From: Date: Wed, 31 Jan 2001 01:50:15 +0000
Subject: Re: .jpg/.gif extension problem!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37387@lists.php.net to get a copy of this message
>But I can't fetch the extension, since php copies the file to c:\windows\temp and calles the file something like phpdfdfe.tmp --> I cant get the extension right (i'm writing it to a db) and the copy() outputs permission denied! If your filename variable is $foo, then $foo_name will have the original name in it. $foo_type will have the mime type. $foo_size will tell you the size of the file. I'm not sure why you are using copy() if you are trying to write the file into a database, but permission denied is a whole 'nother problem. PHP runs as a specific user, that doesn't have full access to your server. This is good. Otherwise, you'd have major security hole. So whatever user PHP runs as, must have permission to write into the directory where you are trying to copy the file. If you are using Windows NT/2K, you can right-click on the directory where you are trying to copy the file to, and you can dink around with enough dialogs and buttons and lists and suchlike to add "iUSR_machinename" to the list of users who can write to that directory. Note that the "machinename" part is something you have to figure out from your IIS MMC or Apache httpd.conf file -- It's the user PHP runs as... If you are using Win95/Win98, I have no idea how to alter permissions on a directory -- As near as I can figure, MS left that feature out... Let me know if you find out differently. If you are using WinME, I'm guessing it's more like NT/2K, but I've never actually seen it, so I dunno. There's also a cool GetImageSize() function in PHP that, even if $foo_name and $foo_type were not there, you could probably use to find out what kind of image you got, as well as its height and width. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#37387) next »