2

I have a custom controller which is outputting file information (image/png) that has been uploaded to the server. Short version looks like this:

class MyController extends \Magento\Framework\App\Action\Action {
    public function execute(){
        // $fullpath becomes abs path on server to my png
        $info = [];
        $info['quote_path'] = $fullpath; 
        $info['order_path'] = $fullpath;
        $info['title']      = "quote item";
        // @var $this->download \Magento\Sales\Model\Download
        $this->download->downloadFile($info);
    }
}

This works fine on my local server, but on my remote server the file doesn't download. Nor does it display properly on my page. I am using the controller path as my img's src attribute and I get an error in chrome:

net::ERR_SPDY_PROTOCOL_ERROR 200

The image appears to load, albeit excruciatingly slow, but then it fails.

Any idea why this may be happening?

Not sure if this is related but the Expires header returned with the image is a year in the past.

The file is 15.8KB

0

Another obscure issue brought about by a simple problem.

I used the class Magento\Sales\Controller\Download\DownloadCustomOption as a model and noticed something missing in my own class. The fix so far seems to be the need for this function before the end of my execute() function, since I'm not returning a result page in my controller. Here it is:

execute(){
    ...
    $this->endExecute();
}

So far seems to be working, not positive this was my only problem yet.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.