[wp-trac] [WordPress Trac] #49658: Incorrect Upload Directory path using wp_upload_dir()

WordPress Trac noreply at wordpress.org
Tue Mar 17 11:35:05 UTC 2020


#49658: Incorrect Upload Directory path using wp_upload_dir()
----------------------------+-----------------------------
 Reporter:  amitkumarsingh  |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  General         |    Version:  5.3.2
 Severity:  normal          |   Keywords:  needs-patch
  Focuses:                  |
----------------------------+-----------------------------
 I usually don't use windows when coding with WordPress.
 I was creating a file in the uploads directory and decided to use
 wp_upload_dir() to get the upload directory path. When I printed the
 result, I noticed that the path returned was incorrect.
 Below is the print_r result of the wp_upload_dir() function:
 Array
 (
     [path] => C:\xampp\htdocs\test/wp-content/uploads/2020/03
     [url] => http://localhost/jan/wp-content/uploads/2020/03
     [subdir] => /2020/03
     [basedir] => C:\xampp\htdocs\test/wp-content/uploads
     [baseurl] => http://localhost/jan/wp-content/uploads
     [error] =>
 )

 As soon as the path enters in the WordPress directory, backslashes are
 converted to front slashes.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49658>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list