Jump to content

Recommended Posts

All right, so this is very strange... I have an AJAX file manager set up, and when I pass information to remove a directory, rmdir() returns true, but DOES NOT DELETE THE DIRECTORY. Using the same script, and simply posting with an HTML form returns true and DOES delete the directory.

 

I'm using Javascript POSTing the data to a PHP script, which returns either true or false - it only returns true if rmdir() returns true; literally.

 

Like I said earlier, I copy/pasted the code to a different file and used an HTML form to POST the data instead of having Javascript POST it, and it works.

 

So here's my question: Why would rmdir() return true if it didn't actually delete the directory?

 

Thoughts?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/161708-solved-spooky-rmdir-problem/
Share on other sites

Actually, it looks like it's working now... What we were doing is (for some reason) passing a hex-encoded version of the directory path, and translating it back into standard text. Don't ask me why... But I saw that yesterday evening and altered it to use the real directory path. All is well in the universe this morning, it seems. Javascript guy says it's working, and it seems to be working for me too.

 

Not sure what the exact problem was, but it was definitely strange. Things work now.

 

Thanks,

David

Neither am I...

 

We were sending through POST something like: 2f746573742f68656c6c6f

and it was being translated from hex to text as: /test/hello

 

Then we'd take that, and append it to the site directory path, so we'd end up with something like:

/home/usr/project/public_html/files/test/hello

 

Which is a valid path, and would make rmdir() return true. Yet it wouldn't get deleted. When I switched it to just pass the /test/hello as a POST variable instead of the hex-encoded variable, it worked.

 

Again, I'm not sure why it was using hex, but there's no reason for it. So I took it out.

 

Still... Strange, right?

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.