milesj / uploader

[Deprecated] A CakePHP plugin for file uploading and validating.
MIT License
193 stars 73 forks source link

Uploader fails when using a remote URL with no extension #118

Closed challgren closed 11 years ago

challgren commented 11 years ago

When importing a URL with no extension the following error is produced. "An unknown error has occurred.

The URL I was using is http://www.gravatar.com/avatar/00000000000000000000000000000000

However it works if I add .jpg to the end of the extension.

HTTP Headers with no extension

Accept-Ranges: bytes Access-Control-Allow-Origin: * Cache-Control: max-age=300 Content-Disposition: inline; filename="00000000000000000000000000000000.jpg" Content-Type: image/jpeg Date: Wed, 05 Jun 2013 18:51:55 GMT Expires: Wed, 05 Jun 2013 18:56:55 GMT Last-Modified: Wed, 11 Jan 1984 08:00:00 GMT Server: ECS (ord/26C7) Source-Age: 1335 Via: 1.1 varnish X-Cache: HIT X-Varnish: 4131622422 4130674815 Content-Length: 2637

HTTP Headers with extension

Accept-Ranges: bytes Access-Control-Allow-Origin: * Cache-Control: max-age=300 Content-Disposition: inline; filename="00000000000000000000000000000000.jpg" Content-Type: image/jpeg Date: Wed, 05 Jun 2013 19:02:25 GMT Expires: Wed, 05 Jun 2013 19:07:25 GMT Last-Modified: Wed, 11 Jan 1984 08:00:00 GMT Server: ECS (ord/26C7) Source-Age: 1335 Via: 1.1 varnish X-Cache: HIT X-Varnish: 4131622422 4130674815 Content-Length: 2637

milesj commented 11 years ago

What do your logs say?

Extensions are required IMO. I've run into so many problems with extensions.

challgren commented 11 years ago

The debug log says

2013-06-05 14:17:22 Debug: 00000000000000000000000000000000. is not a valid image

I tried to search for the string is not a valid image and did not come up with any results in the packages you provided.

milesj commented 11 years ago

Transit is throwing the exception. Are you trying to run any transforms?

Basically it's saying that the mimetype is not an image. Are you sure it's an image? Try and debug what mimetype it is extracting.

challgren commented 11 years ago

This is my active actAs

public $actsAs = array(
    'Containable',
    'Uploader.Attachment' => array(
        'image' => array(
            'nameCallback' => '',
            'append' => '',
            'prepend' => '',
            'tempDir' => TMP,
            'uploadDir' => '',
            'finalPath' => '',
            'dbColumn' => 'image',
            'metaColumns' => array(),
            'defaultPath' => 'tester.jpg',
            'overwrite' => true,
            'stopSave' => true,
            'allowEmpty' => true,
            'transforms' => array(
                'imageSmall' => array(
                    'method' => AttachmentBehavior::CROP, // or crop
                    'append' => '-small',
                    'overwrite' => true,
                    'self' => false,
                    'width' => 100,
                    'height' => 100
                ),
                'imageMedium' => array(
                    'method' => 'resize',
                    'append' => '-medium',
                    'width' => 800,
                    'height' => 600,
                    'aspect' => false
                )
            ),
            'transport' => array()
        ),
    )
);
milesj commented 11 years ago

Remove all those settings that aren't setting anything.

Also, these aren't the logs. Whats in error or debug log?

milesj commented 11 years ago

This is fixed in Transit 1.3.2.