eranwein Posted March 21, 2006 Share Posted March 21, 2006 i need to check if an uploaded file exists. i'm using file_exists($filename). as i understand, the $filename should be the path and name of the uploaded file.$_FILES['uploadedFile']['name'] returns only the name but not the path. so how do i do it? Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted March 21, 2006 Share Posted March 21, 2006 [!--quoteo(post=356872:date=Mar 21 2006, 06:24 AM:name=eranwein)--][div class=\'quotetop\']QUOTE(eranwein @ Mar 21 2006, 06:24 AM) [snapback]356872[/snapback][/div][div class=\'quotemain\'][!--quotec--]i need to check if an uploaded file exists. i'm using file_exists($filename). as i understand, the $filename should be the path and name of the uploaded file.$_FILES['uploadedFile']['name'] returns only the name but not the path. so how do i do it?[/quote]the file is uploaded to $_FILES['uploadedFile']['tmp_name']. best thing to do then is to use is_uploaded_file, such as:[code]if (is_uploaded_file($_FILES['uploadedFile']['tmp_name'])) { ... we got the file, use move_uploaded_file to put it in a proper home}else{ .... we not got the file}[/code]hope that helps Quote Link to comment Share on other sites More sharing options...
eranwein Posted March 21, 2006 Author Share Posted March 21, 2006 thanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.