Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.