dogdaynoon Posted January 9, 2014 Share Posted January 9, 2014 Hello, i have the following code: php 5, ms server 2008, iis 7 I pass this script a csv list of file paths like so... ,C:\path\path\path\file.name,C:\path\path\anotherFile.name,C:\path\path\path\file3.file (yes there is a leading comma in the string for some reason..) $files = $_POST['files']; $files = explode(',', $files) foreach($files as $filename){ if(file_exists($filename)){ echo '":' . $filename .':"Does Exist<br />'; } else { echo 'Sorry ":' . $filename . ':" Does Not Exist<br />'; } } My problem: the first file path shows it exists and there is no white space in the string, all the file paths after the first one show like such: ":C:\path\path\path\file.name:" Does Exist // 1st path (good) ": C:\path\path\anotherFile.name :" Does Not Exist ": C:\path\path\file3.file:" Does Not Exist pleas note... i put the ": and :" in there to show that there is indeed a white space character in front of and behind the filepaths. EXCEPT for the last path.. there is no trailing white space there. Please explain why you think the white space is being added to these and what i can do to get rid of it. thanks, dogdaynoon Quote Link to comment Share on other sites More sharing options...
Solution .josh Posted January 9, 2014 Solution Share Posted January 9, 2014 not enough info/material to give a definitive answer about the whitespace, but is there any reason why you can't just trim($filename) ? Quote Link to comment Share on other sites More sharing options...
dogdaynoon Posted January 9, 2014 Author Share Posted January 9, 2014 I did try trim, and it had been returning the same results... I went ahead and tried it again, just for good measure and it seems to be working now... thanks man. 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.