[wp-trac] [WordPress Trac] #32549: wp_remote_get does not stream to temp file

WordPress Trac noreply at wordpress.org
Tue Jun 9 03:41:03 UTC 2015


#32549: wp_remote_get does not stream to temp file
--------------------------+----------------------
 Reporter:  andddd        |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  HTTP API      |     Version:  4.2.2
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by dd32):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 The `stream` parameter expects a `filename` path to be specified, ie.
 `/var/folders/4p/s0vgsy5s19g63q9t0zd56hkw0000gn/T/file.zip`, not
 `file.zip`. If you pass a relative path into that, it's saved within the
 current working directory (in my testing, it went into `wp-admin/` as I
 triggered it through `wp-admin/admin-post.php`).

 `wp_unique_filename()` only returns a file name, it does not return a
 path, it's designed to find a unique file'''name''' within a folder.

 It looks like you want to be using `$filename = wp_tempnam( $zip_url );`
 instead of `wp_unique_filename()`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32549#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list