HuntsvilleMan Posted May 9, 2011 Share Posted May 9, 2011 I'm unsure what to put in the path statement below. My attemps so far end up in an error message. Here is what I know: The company that host my files has me at a web address like: mycompany6.com In that root directory I have a subdirectory named: php In that subdirectory I have a file named: testfile.mp3 Getting the path statement right seems to be my problem. Below is my last failed try. $file = "testfile.mp3"; $path = $_SERVER['mycompany6.com']."/php/"; $file = $path.$filename; $file_size = filesize($file); echo $file_size; Do I have enough information to complete the path statement or do I need another piece of information from my web hosting service? Thanks for an explanation of how to get the path statement right. Mike Quote Link to comment https://forums.phpfreaks.com/topic/235967-how-to-get-syntax-right-for-a-file-name/ Share on other sites More sharing options...
spiderwell Posted May 9, 2011 Share Posted May 9, 2011 have you echoed out $path to see what it says? where is the php file that is doing this located? Quote Link to comment https://forums.phpfreaks.com/topic/235967-how-to-get-syntax-right-for-a-file-name/#findComment-1213087 Share on other sites More sharing options...
fugix Posted May 9, 2011 Share Posted May 9, 2011 have you tried $file = "testfile.mp3"; $path = http://www.mycompany6.com/php/; $file = {$path}{$filename}; $file_size = filesize($file); echo $file_size; Quote Link to comment https://forums.phpfreaks.com/topic/235967-how-to-get-syntax-right-for-a-file-name/#findComment-1213089 Share on other sites More sharing options...
jcbones Posted May 9, 2011 Share Posted May 9, 2011 Make a simple file in the directory of the file you wish to get the size of, and call it from the browser. test.php <?php echo __FILE__; ?> Then copy that as the file path. Of course, change the filename at the end to the correct filename. This is the easiest method that I can think of, that will give YOU the filepath of your file. Otherwise, you could try all day with suggestions. Documentation Quote Link to comment https://forums.phpfreaks.com/topic/235967-how-to-get-syntax-right-for-a-file-name/#findComment-1213108 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.