Jump to content

How to get syntax right for a file name


Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/235967-how-to-get-syntax-right-for-a-file-name/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.