<pre class="cake-error">
$file = object(File) {
Folder => object(Folder) {}
name => '200323860053ad7ddaaaddd.png'
info => array(
'dirname' =>
'/var/www/upfree/up-free.com/files/posts/attach',
'basename' => '200323860053ad7ddaaaddd.png',
'extension' => 'png',
'filename' => '200323860053ad7ddaaaddd',
'filesize' => (int) 10026,
'mime' => 'image/png'
)
handle => resource
lock => null
path =>
'/var/www/upfree/up-free.com/files/posts/attach/200323860053ad7ddaaaddd.png'
}
$range = null
$compress = false
$end = false
$start = false
$bufferSize = (int) 8192</pre><pre class="stack-trace">set_time_limit -
[internal], line ??
CakeResponse::_sendFile() - CORE/Cake/Network/CakeResponse.php, line 1375
CakeResponse::send() - CORE/Cake/Network/CakeResponse.php, line 425
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 169
require - APP/webroot/index.php, line 97
[main] - ROOT/index.php, line 13</pre></div></pre>‰PNG
пятница, 27 июня 2014 г., 1:24:55 UTC+3 пользователь AD7six написал:
>
>
>
> On Friday, 20 June 2014 20:05:55 UTC+2, Alexandr Pirogov wrote:
>>
>> Help me, please, to resolve my small problem! I have next function in my
>> PostsController:
>>
>> public function download() {
>> if (isset($this->request->query['file']) && is_file(POST_ATTACH_PATH .
>> $this->request->query['file'])) {
>> $file = $this->request->query['file'];
>> $output_name = 'up_free_' . rand();
>>
>> $this->response->file(POST_ATTACH_PATH . $file, array(
>> 'download' => true, 'name' => $output_name
>> ));
>>
>> return $this->response;
>> } else {
>> $this->redirect(array('controller' => 'posts', 'action' => 'index'));
>> }}
>>
>>
>> The problem is that my download function returns me *'empty'* file! For
>> example, if I have attached an image to the post and click the download
>> button, my image downloads! But downloaded file is 'empty', I can't open it
>> and if it is .jpg file it has the size of 132 KB.
>>
>> Thank You!
>>
>>
> 132KB is not empty - try opening it as a text file - it probably contains
> error messages.
>
> AD
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.