Skip to content

Instantly share code, notes, and snippets.

@micahwave
Created February 7, 2012 17:31
Show Gist options
  • Save micahwave/1760851 to your computer and use it in GitHub Desktop.
Save micahwave/1760851 to your computer and use it in GitHub Desktop.
ooyala
add_filter('sanitize_file_name', array(&$this, 'add_extension' ) );
// Download file to temp location
$tmp = download_url( $url );
remove_filter('sanitize_file_name', array(&$this, 'add_extension' ) );
preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $tmp, $matches);
$file_array['name'] = basename($matches[0]);
$file_array['tmp_name'] = $tmp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment