Sagar Naliyapara Sagar Naliyapara - 5 months ago 46
PHP Question

rename(): Cannot rename a file across wrapper types

When i upload image it gives me following error:


rename(): Cannot rename a file across wrapper types


here what i have done:

rename($sourcePath, $destinationPath)


in above variable it contains path of image including image name

can anyone help?

Thank you!

Answer

The problem is in your $sourcePath... If I'm not mistaken, your $sourcePath contains http://, try removing that and replace it with a local path instead.

For example, if you're current $sourcePath is:

http://domain.com/uploads/image.jpg

Replace it with:

/uploads/image.jpg