Jump to content

[SOLVED] PHP Path Problem


ballouta

Recommended Posts

Hello

 

I have a function that decompresses a Zip file. It is working properly when I am writing the zip file name without any previous path before. e.g.: file.zip

 

When editing the path to:

$archive = new PclZip('/home/sitename/public_html/stk/$user/$myf');

or

$archive = new PclZip(/stk/$user/$myf');

 

The functions says that the file is missing.

Note that both the 'stk' and '$user' directory already exisit.

 

Why it is NOT detecting the file name?

Link to comment
https://forums.phpfreaks.com/topic/110023-solved-php-path-problem/
Share on other sites

Also, try this to get a listing of the files in the directory base.  You may find that the program is referencing a different directory base to the one you're expecting.

if ($handle = opendir("../")) {
while (false !== ($file = readdir($handle))) {
	print($file."<br>");
}
closedir($handle);
}

the Library File is very long (aroung 5000 lines!) but the function is this one:

 

  function PclZip($p_zipname)
  {
    //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::PclZip', "zipname=$p_zipname");

    // ----- Tests the zlib
    if (!function_exists('gzopen'))
    {
      //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 1, "zlib extension seems to be missing");
      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
    }

    // ----- Set the attributes
    $this->zipname = $p_zipname;
    $this->zip_fd = 0;
    $this->magic_quotes_status = -1;

    // ----- Return
    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 1);
    return;
  }

 

When I write the zip file for it as is, and it is in the same location of this code, it works properly and uncompresses the zip file.

 

Please make sure that I do NOT have problem in my path syntax or concept.

thanks

I echo both varaiabled $user & $myf and they are correct.

$user printed for me the correct user loged in and $myf printed the zip file name.

 

The problem is that the code is giving this error: Missing archive file '/stk/$user/$myf'

 

stk is an exisitng directory, $user is also a new directory created before uncompressing the code, and i can see it.

 

where's the problem now? and if the folder permissions are uncorrect how do I fix it?

 

thanks

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.