Jump to content

Creating a link to a pdf file


henryluiz

Recommended Posts

Hi,

I have upgraded to the latest version and now experience "network error"  when I upload a document. I  clear cache and I can upload the document with no error. The then try a second upload this then fails with network error.

What is the correct way to upload a pdf and create a link to a pdf document in a product description.

regards

Henry

Link to comment
Share on other sites

The term "Network Error" is too generic to pin-point what is (or is not) happening.

What do you actually have in your browser window that purports to be a Network Error"? A 4XX or 5XX error response code from the web server? Any part of a page that looks like a CubeCart page?

Try to find any and all error logs. If you are hosted by someone, that someone may be needed to assist you in examining error logs.

 

Link to comment
Share on other sites

I see in the image that there is (I guess that's what this is) a browser tab named "henrytest (9).pdf" which has a "Network error" flag. (Might these tabs be instances of a PDF reader app???)

If a browser tab, then when working with the browser hoping to get the next Network error, have the browser's Developer Tools open to the Network tab. There will be more info as to what the error message is that the web server is sending back.

The "Deprecated" errors will be fixed in the next version of CubeCart. They are caused by PHP 8 being more strict in the treatment of variables.

Link to comment
Share on other sites

HI 

These tabs are the download tabs that Chrome shows when downloading a pdf file to the local pc.

If I clear Cubecart cache I do not this error message on the first download, but then get the error message on the next PDF download

I have done some further testing....I copy this site and db to a local host in my network and it does not have this network error message

In relation the deprecated errors they are generated every 2-3 minutes filing the log file. Is There a way to disable this.

Appreciated you help

deperrors.JPG

Edited by henryluiz
Link to comment
Share on other sites

An issue has been posted in the Github:

https://github.com/cubecart/v6/issues/3096
In /admin/sources/products.index.inc.php, near line 1030, find:

$possible = false;

Change to:

$possible = array();

Near line 1051, find:

if (is_array($possible)) {

Change to:

if (!empty($possible) && is_array($possible)) {

Or, if you have CubeCart's "debug mode" enabled, but do not really need it, turning off debug mode should stop the Deprecated notices getting logged.

Edited by bsmither
Link to comment
Share on other sites

Please try this:

In the admin file /sources/filemanager.index.inc.php:

Near line 32, find:

$select_button = false;
if (isset($_GET['mode'])) {
    switch (strtolower($_GET['mode'])) {

Add after:

case 'fckfile':
$GLOBALS['main']->hideNavigation(true);
$select_button = true;

In the admin skin template file filemanager.index.php:

Near line 43, find:

      {if isset($FILES)}
      {foreach from=$FILES item=file}
      <div {if $FILMANAGER_MODE == '1'}class="fm-item {$FM_SIZE}{if $file.file_name_hash==$HILIGHTED_FILE} hilighted{/if}"{/if} id="{$file.file_name_hash}">
      {if $FILMANAGER_MODE == '1'}<a href="{$file.master_filepath}?{$file.random}" class="{$file.class} thumbnail" title="{$file.description}" target="_self"><img class="lazyload" data-src="{$file.filepath}" src="data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs="></a>{/if}
      <span class="actions">
         {if $FILMANAGER_MODE == '1'}<input type="checkbox" value="{$file.value}" class="multi_delete right" name="multi_delete[]"> {/if}{$file.filesize}
         {if $file.select_button}
         <a href="{$file.master_filepath}" class="select"><i class="fa fa-plus-circle" title="{$LANG.common.add}"></i></a>
         {else}
         <a href="{$file.delete}" class="delete right" title="{$LANG.notification.confirm_delete_file|replace:'%s':$file.filename}"><i class="fa fa-trash" title="{$LANG.common.delete}"></i></a>
         <a href="{$file.edit}" class="edit right" title="{$LANG.common.edit}"><i class="fa fa-pencil-square-o" title="{$LANG.common.edit}"></i></a>
         {/if}
      </span>
      {if $FILMANAGER_MODE == '2'}<input type="checkbox" value="{$file.value}" class="multi_delete" name="multi_delete[]"> <i class="fa fa-{$file.icon}" aria-hidden="true" alt="{$file.mimetype}"></i>{/if}
      <a href="{if $file.class}{$file.filepath}?{$file.random}{else}?_g=filemanager&download_file={$file.filepath|base64_encode}{/if}" class="{$file.class}" title="{$file.description}" target="_self">{$file.filename}</a>
      </div>
      {/foreach}
      {else}
      <p class="center clear">{$LANG.filemanager.file_none}</p>
      {/if}

Change to:

{if isset($FILES)}
  {foreach from=$FILES item=file}
      <div {if $FILMANAGER_MODE == '1'}class="fm-item {$FM_SIZE}{if $file.file_name_hash==$HILIGHTED_FILE} hilighted{/if}"{/if} id="{$file.file_name_hash}">
    {if $FILMANAGER_MODE == '1'}
         <a href="{$file.master_filepath}?{$file.random}" class="{$file.class} thumbnail" title="{$file.description}" target="_self">
            <img class="lazyload" data-src="{$file.filepath}" src="data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=">
         </a>
         <span class="actions">
            <input type="checkbox" value="{$file.value}" class="multi_delete right" name="multi_delete[]">
            {$file.filesize}
      {if $file.select_button}
            <a href="{$file.master_filepath}" class="select"><i class="fa fa-plus-circle" title="{$LANG.common.add}"></i></a>
      {else}
            <a href="{$file.delete}" class="delete right" title="{$LANG.notification.confirm_delete_file|replace:'%s':$file.filename}"><i class="fa fa-trash" title="{$LANG.common.delete}"></i></a>
            <a href="{$file.edit}" class="edit right" title="{$LANG.common.edit}"><i class="fa fa-pencil-square-o" title="{$LANG.common.edit}"></i></a>
      {/if}
         </span>
    {/if}
    {if $FILMANAGER_MODE == '2'}
         <input type="checkbox" value="{$file.value}" class="multi_delete" name="multi_delete[]"> <i class="fa fa-{$file.icon}" aria-hidden="true" alt="{$file.mimetype}"></i>
      {if $file.select_button}
         <span class="actions">
         <a href="{$file.master_filepath}" class="select"><i class="fa fa-plus-circle" title="{$LANG.common.add}"></i></a>
         </span>
      {/if}
    {/if}
         <a href="{if $file.class}{$file.filepath}?{$file.random}{else}?_g=filemanager&download_file={$file.filepath|base64_encode}{/if}" class="{$file.class}" title="{$file.description}" target="_self">{$file.filename}</a>
      </div>
  {/foreach}
{else}
      <p class="center clear">{$LANG.filemanager.file_none}</p>
{/if}

In the file /includes/ckeditor/config.js:

Find:

config.filebrowserBrowseUrl = document.location.pathname+'?_g=filemanager&mode=fck';

Change to:

config.filebrowserImageBrowseUrl = document.location.pathname+'?_g=filemanager&mode=fck';
config.filebrowserLinkBrowseUrl = document.location.pathname+'?_g=filemanager&mode=fckfile';

This will bring up a list of files in CubeCart's /files/ folder, the same folder that CubeCart uses to store all the files that are tied to digital-type products -- the downloadable digital products. This folder and all sub-folders (save one) are restricted against direct access by way of a directive in the .htaccess file in /files/. (This restriction provided by .htaccess is only effective if the web server finds and respects .htaccess files. For example, Apache does, but Nginx does not.)

Within /files/, there is another folder /public/ that has its own .htaccess directive giving unrestricted access.

So, be sure to link only to files found in this /public/ folder. Otherwise, the links to PDFs you put in Product Descriptiion won't get anything for visitors to your site.

A Feature Request has been posted to the Github.

Edited by bsmither
Link to comment
Share on other sites

  • 5 weeks later...

Hi,

I have updated the above files.

I use file manager/downloads to upload a pdf.

To create the link in the document I can only "browser server" the images file not the file directory where I have upload the pdf doco.

web site is www.birkettcontrols.com.au

I have included screen shots and copies of the change files.

Have I done anything wrong.

Your help is appreciated.

upload pdf screen.JPG

home page with pdf link.JPG

filemanager.index.inc.php filemanager.index.php config.js

Edited by henryluiz
Link to comment
Share on other sites

The image above suggests you found "henry_test.pdf", which is in the /files/ directory. Or am I mistaken as to where the encircled text came from?

When you load the page where you can edit the product's description, engage the browser's Developer Tools (usually via the keyboard key F12).

There should be a Debugger tab where there is a list of all the javascript files loaded can be viewed.

Make sure that includes/ckeditor/config.js?t=J5S8 is present, and when viewing the file's contents, make sure it has the edited lines. (The J5S8 may be some other code number.)

If not, then the browser might be using an internally cached copy of config.js. If so, then force the browser to reload fresh copies of all page resources. This is usually done with CTRL+F5.

Check for the fresh file.

Edited by bsmither
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...