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
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);
}

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.