• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

PHP or MySQL: which is faster in this scenario?

LeX

ლ(╹◡╹ლ)
NLC
I've written an upload script, and I need it to check if the filename it's uploading already exists on the server every time somebody uploads something. I have two methods of checking, one using PHP's file_exists, the other is grabbing the table from MySQL. The question is, which method is more efficient, or less server-extensive?
 
Hi there,

If you know where the file will be located, without looping directories, I would pick file_exists.

Ps: its nice to see some of the orginal members are still around, from Oct. 2000!
 
Yah, I still lurk here from time to time, mainly in the general discussion section. ;)

Thanks by the way.
 
i wouldnt really say either one is that much quicker just cause either way it needs to scan for the file name. file_exists, from what i have read is a little faster, but, i am not 100% on that. if Joe was still around, he would be the best person to ask, but, Carl may have some input on that. good to see you lurking still brother. i havent been to active myself lately, but, still around.
 
IMO I think file_check would probably work the best so you don't have to keep checking mysql tables if you have a lot of files on your server.
 
Back
Top