0

I am unzipping some files and folders from an upload but the zip contains the files and folders one directory too deep. So currently they are located

path-to-folder/anotherdirectory/

When I need them to be located at

path-to-folder/

I have tried using the PHP rename function but get an error stating http 'wrapper does not support renaming in...'

Does anyone know the Drupal way to do this please

0

Sounds like you are trying to rename files by specifying their Url. You can't do that. You have to specify the path to the file. It's a PHP issue rather than a Drupal issue. Try this instead:

rename($_SERVER['DOCUMENT_ROOT'].'/path-to-folder/anotherdirectory/filename.ext', $_SERVER['DOCUMENT_ROOT'].'/path-to-folder/filename.ext');
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.