Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Uploading files without extensions

Status
Not open for further replies.

frosty7700

Programmer
Aug 10, 2001
95
US
I have a PHP script for uploading and listing files in a Linux filesystem. When listing, I use the following condition:

if eregi("\.",$file) == false

...to determine if an item is a subdirectory or a file. If it is false, it's a subdirectory.

PROBLEM: When I upload a file with no extension on it, it is listed as a subdirectory (even though Linux seems to know knows it's a file just fine). I think I'm missing something obvious, but I can't crack it. Ideas?
 
Ugh...nevermind...I'm dumb. If there's no period, obviously it'll see it as a directory based on that command.

SO...is there any other way to test it to see if it's a file or not? This way is way too flakey.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top