rackspace/php-cloudfiles — Issue #50: Allow string to be passed to _guess_content_type
Author: synexis
Created: 2011-12-04 22:45:18+00:00
State: open

Hi, I'm hoping this is right place/way to bring this up...

The CF_Object::write method allows a string, but when passed to _guess_content_type this triggers a BadContentTypeException if the object did not yet exist.

Consider:
# ... authentication/connection/container code excluded
$cont = $conn->get_container('my_container');
$obj = $cont->create_object('new_file.txt');
$obj->write('Hello there');

Perhaps the following could be added to _guess_content_type:

if(is_string($handle)) {
$this->content_type = 'text/plain';
return;
}

Thanks.