Front End File Management (Uploads) Downloads fail

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
jsykes
New Member
New Member
Posts: 6
Joined: Mon Dec 15, 2008 2:10 am

Front End File Management (Uploads) Downloads fail

Post by jsykes »

Steps to reproduce:
1. Install latest full CMSMS 1.5.1
2. Install Uploads module using Module Manager
3. Added a Members category to Front End File Management. This is to test a 'members only' area for file uploads, newsletter access etc.
4. Upload a small PDF using the Admin Console, Front End File Management (Uploads), Files page

Sample site is http://cmsms.shorefx.com

I added the following to the How CMSMS Works sample page:

{cms_module module="Uploads" category="Members" mode="detailed"}

This works and lists the PDF file I uploaded in step 4 above.

With debug off in config.php the download link fails with the error:

C:\...\LOCALS~1\Temp\Rt1yCf_4.pdf.part could not be saved, because the source file could not be read.

With debug on in config.php the download link works fine and the PDF file is successfully downloaded to my local PC.

Does anyone have any ideas what would cause this and why it's dependant on the debug setting?

The direct access URL to the PDF works fine:

http://cmsms.shorefx.com/uploads/member ... letter.pdf

I think this isolates the issue to something within CMSMS and the Uploads module.

I was able to reproduce this exact same issue on a local WAMP (Apache2triad) installation too.

I've tested with both IE and Firefox on more than one machine to eliminate the browser and machine from the equation.

Any help would be appreciated. Thanks, Jon.
Last edited by jsykes on Mon Dec 15, 2008 3:08 am, edited 1 time in total.
jsykes
New Member
New Member
Posts: 6
Joined: Mon Dec 15, 2008 2:10 am

Re: Front End File Management (Uploads) Downloads fail

Post by jsykes »

I've been trying to debug this myself. I'm not a PHP programmer, but I seem to be making some progress by making some changes to the file action.getfile.php within the Uploads module.

If I comment out the line (enabling output buffering):

for ($cnt = 0; $cnt ob_gzhandler [1] => default output handler [2] => default output handler )

If I execute ob_end_clean() two times, downloads work. If it is executed a third time (closing the last remaining output handler) downloads fail. This is reaching the limit of my php knowledge. I'm not sure why turning off all three should fail. I can see other examples on the www where this is done.

FYI - I also found an interesting site here:

http://w-shadow.com/blog/2007/08/12/how ... -with-php/

This shows an example of supporting download resuming too. I've successfully added this to my local copy of action.getfile.php. This example only executes ob_end_clean once.

Regards, Jon
hesbas

Re: Front End File Management (Uploads) Downloads fail

Post by hesbas »

Hi Jon,

Seems you have the same trouble I'm wrestling with.

http://forum.cmsmadesimple.org/index.php/topic,29098.0.html

Still no working answer yet.
jsykes
New Member
New Member
Posts: 6
Joined: Mon Dec 15, 2008 2:10 am

Re: Front End File Management (Uploads) Downloads fail

Post by jsykes »

I'm using my patched code for now. It's working fine so far. It would be nice to get this fixed in the mainstream code base so I don't have to re-patch each time I update CMSMS.

Before that, I would be like to have a PHP expert comment on the issue at the line I posted earlier.

I'm not convinced it's specific to a PHP version. My local apache2triad uses PHP 4.4.2. My online host uses PHP 5.2.8. The same CMSMS FEU code had identical problems on both locations.

It's also not OS specific. My apache2triad install is a WAMP package. My online host uses linux.

The problem occurs on all the PCs I've tested and within both Firefox and IE.

Other than the code itself, I'm not sure what other variables I can eliminate.

Jon.
hesbas

Re: Front End File Management (Uploads) Downloads fail

Post by hesbas »

Hi Jon,
If I comment out the line (enabling output buffering):

for ($cnt = 0; $cnt < sizeof($handlers); $cnt++) { ob_end_clean(); }
Works for me too!

Only the filename stil is not displayed yet.

Maybe someware else in the code this problem is also present'.

Touble is I have absolutely no experience with PHP.
jsykes
New Member
New Member
Posts: 6
Joined: Mon Dec 15, 2008 2:10 am

Re: Front End File Management (Uploads) Downloads fail

Post by jsykes »

I recently found it was more reliable to change the line instead of just comment it out. Otherwise I got some extra characters in the download stream sometimes which may have been the reason for closing all of the handlers in the original code. The change is:

for ($cnt = 0; $cnt block. If mode is set to url you just get the url and you can wrap it with an and name of your choice.

Is it this that's not working for you?

What I would like is a mode that creates a link, but uses the file summary text from the upload module instead of the actual file name. I haven't figured out how to do that yet. I would prefer not to hard code the text for the link in the page content.

Jon.
hesbas

Re: Front End File Management (Uploads) Downloads fail

Post by hesbas »

I changed the line as you did, only it ended up like before: links did not work anymore!

But you shrunk the amount of handlers with -1, so I tried -2. That works!! May be you understand this beheavour.

The links is still something I do not get... The line you use works, but I had a custom summary layout witch worked fine only now misses the link. Although the link in the icon (between the same tags as the link to the filename) is working fine now.

Code: Select all

<!-- Start Upload Display Template -->
{if isset($input_filter) }
{$startform}
{$prompt_filter}{$input_filter}{$hidden_params}{$input_submit}
{$endform}
<br/>
{$matches} {$matchestext}
{/if}
<table class="upload">
  <tr>
    <th class="bh_sum">{$summary}</th>
    <th class="bh_name">{$name}</th>
    <th class="bh_date">{$date}</th>
    <th class="bh_size">{$size}</th>
    <th class="bh_auth">{$author}</th>
  </tr>
{foreach from=$items item=entry}
  <tr class="{$entry->rowclass}"> 
    <td class="b_sum">{$entry->summary}</td>
    <td class="b_name">
      <a href="{$entry->download_url}">
      {if isset($entry->thumbnail_url)}
        {$thumbnail} <img src="{$entry->thumbnail_url}" border="0"/>
      {else}
        <img src="{$entry->iconurl}" border="0"/>
      {/if}
	   {$entry->name}</a>
	</td>
    <td class="b_date">{$entry->date}</td>
    <td class="b_size">{$entry->size}</td>
    <td class="b_auth">{$entry->author}</td>    
  </tr>
{/foreach}
</table>
<!-- End Upload Display Template -->
Bas
Last edited by hesbas on Fri Dec 26, 2008 12:47 pm, edited 1 time in total.
Pierre M.

Re: Front End File Management (Uploads) Downloads fail

Post by Pierre M. »

Hello,

thank you for reporting so well and eliminating things from the equation.
jsykes wrote: I'm using my patched code for now. It's working fine so far. It would be nice to get this fixed in the mainstream code base so I don't have to re-patch each time I update CMSMS.

Before that, I would be like to have a PHP expert comment on the issue at the line I posted earlier.
I agree it is nice to fix and to incorporate the fix into mainline if the module maintainer acknowledges the bug and the fix.

Hopefully some "PHP expert" (which I am not) is going to stand up here but you'd rather file your nice bug report and suggested solution in the forge because it is were the devs track code issues.

Have fun with CMSms

Pierre M.
rscott
New Member
New Member
Posts: 4
Joined: Sun Dec 28, 2008 6:30 pm

Re: Front End File Management (Uploads) Downloads fail

Post by rscott »

Just to add a 'me too'. I'm having the same problem with a fresh install. I'm on Centos 4 with php 5.2.6.

System info:-

----------------------------------------------

Cms Version: 1.5.1

Installed Modules:

CMSMailer: 1.73.14
FileManager: 0.4.3
MenuManager: 1.5.3
ModuleManager: 1.2.1
News: 2.9.1
nuSOAP: 1.0.1
Printing: 0.2.6
Search: 1.5.2
ThemeManager: 1.0.8
TinyMCE: 2.4.10
Uploads: 1.4


Config Information:

php_memory_limit:
process_whole_template: true
max_upload_size: 2000000
default_upload_permission: 664
assume_mod_rewrite: false
page_extension:
internal_pretty_urls: false
use_hierarchy: false


Php Information:

phpversion: 5.2.6
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
memory_limit: 32M
max_execution_time: 1800
safe_mode: Off (False)
session_save_path: /var/lib/php/session (0770)


Server Information:

Server Api: apache2handler
Server Db Type: MySQL (mysql)
Server Db Version: 5.0.58


----------------------------------------------
Pierre M.

Re: Front End File Management (Uploads) Downloads fail

Post by Pierre M. »

Use the forge, Luke : two days ago I've reported a bug in the TinyMCE section in the forge. It is fixed in SVN today.
(Nuno) The TinyMCE maintainer rocks :-) as all the core DevTeam

For the record : everybody can improve the documentation in the wiki with his/her forum account and everybody can file bug reports in the forge (in the relevant section) with a forge account.

Pierre M.
rscott
New Member
New Member
Posts: 4
Joined: Sun Dec 28, 2008 6:30 pm

Re: Front End File Management (Uploads) Downloads fail

Post by rscott »

Bug has now been reported - http://dev.cmsmadesimple.org/bug/view/2817
boscopup
Forum Members
Forum Members
Posts: 35
Joined: Wed May 04, 2005 3:48 pm

Re: Front End File Management (Uploads) Downloads fail

Post by boscopup »

jsykes wrote: for ($cnt = 0; $cnt < sizeof($handlers); $cnt++) { ob_end_clean(); }

with

for ($cnt = 0; $cnt < (sizeof($handlers) - 1); $cnt++) { ob_end_clean(); }
This fix worked for me too.

My system (running Linux 2.6.9):

----------------------------------------------

Cms Version: 1.5.1

Installed Modules:

    * MenuManager: 1.5.3
    * News: 2.9.1
    * ThemeManager: 1.0.8
    * ModuleMaker: 0.2
    * Bookmarks: 2.0.1
    * CMSMailer: 1.73.14
    * Calendar: 1.0
    * FrontEndUsers: 1.5.4
    * Uploads: 1.4
    * CustomContent: 1.5.2
    * HOTCContacts: 0.1
    * nuSOAP: 1.0.1
    * ModuleManager: 1.2.1
    * FeedbackForm: 0.9.15
    * Captcha: 0.3.2
    * FileManager: 0.4.3
    * Printing: 0.2.6
    * CGExtensions: 1.14.1
    * FormBuilder: 0.5.10
    * TinyMCE: 2.4.10


Config Information:

    * php_memory_limit:
    * process_whole_template: true
    * max_upload_size: 2000000
    * default_upload_permission: 664
    * assume_mod_rewrite: false
    * page_extension:
    * internal_pretty_urls: false
    * use_hierarchy: true


Php Information:

    * phpversion: 4.4.7
    * md5_function: On (True)
    * gd_version: 2
    * tempnam_function: On (True)
    * magic_quotes_runtime: Off (False)
    * memory_limit: 32M
    * max_execution_time: 200
    * safe_mode: Off (False)
    * session_save_path: /tmp (1777)


Server Information:

    * Server Api: cgi
    * Server Db Type: MySQL (mysql)
    * Server Db Version: 4.1.22


----------------------------------------------
amhoffmaster
Forum Members
Forum Members
Posts: 121
Joined: Sat Jan 03, 2009 5:05 pm

Re: Front End File Management (Uploads) Downloads fail

Post by amhoffmaster »

I'm having the same issue. Uploads work fine. The  Front End User Management (Uploads) records the number of times that I clicked to get the download. But the link I clicked to download the file references a file on my local machine. The Forge indicates that there's a fix, but, it doesn't say what the fix is. I don't understand the modifications that people are making in these posts. I'm new at this and I'm a designer, not a php programmer. Any help woud be greatly appreciated.
Last edited by amhoffmaster on Thu Jan 22, 2009 3:50 am, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Front End File Management (Uploads) Downloads fail

Post by calguy1000 »

disable output compression in your config.php

Code: Select all

$config['output_compression'] = false;
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
amhoffmaster
Forum Members
Forum Members
Posts: 121
Joined: Sat Jan 03, 2009 5:05 pm

Re: Front End File Management (Uploads) Downloads fail

Post by amhoffmaster »

The compression was already set to false in the config file.
Any other ideas?
Post Reply

Return to “Modules/Add-Ons”