Just got it working.
$path_array = wp_upload_dir();
$path = str_replace('\\', '/', $path_array['path']);
$old_name = $_FILES["image_upload_path"]["name"];
$split_name = explode('.',$old_name);
$time = time();
$file_name = $time.".".$split_name[1];
move_uploaded_file($_FILES["image_upload_path"]["tmp_name"],$path. "/" . $file_name);
working fine for me on local server
Okay , but my problem is that I am uploading it from a plugin in the admin part. I want the files to get uploaded in the ‘wp-content/uploads’ folder. So any idea?
Hello aerin,
I am facing the same problem now ; but the problem is with the parameter. As you might know ‘move_uploaded_file’ doesn’t support any ‘http://’ links to move the files. So you are getting the problem. I am also looking for a way around as I am a newbie in WP-Plugin development. Do let me know if you found out anything.