Using move_uploaded_file in a plugin
-
I’m developing a simple plugin that manages logo uploads.
The plugin has a form that allows the user to upload and image from their PC. This works fine.
But I want to save the uploaded file to the server. This is where it all comes unstuck.
move_uploaded_file seems to be an ideal solution but WP throws a wobbly:
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phpCnl49u’ to ‘http://testblog.co.uk/wp-content/themes/themename/images/28d0a66d7f8fddb23b577b89ee2c68d5.jpg’ in /home/wwwtestb/public_html/wp-content/plugins/logo-uploader/logo-uploader.php on line 68
Line 68 is:
if (move_uploaded_file($_FILES['lu_logo']['tmp_name'], $target_path . $filename)) {
Really stumped on this one. It’s not a permissions thing because it fails if I try to upload to the uploads folder as well.
Any thoughts?
- The topic ‘Using move_uploaded_file in a plugin’ is closed to new replies.