Jump to content

How to set up for public file download


cqpbert

Recommended Posts

I feel like this has been asked and likely answered, but searching did not get me what I needed. I need to be able to put files in a place and somehow provide access to a digital download.I don't think this is a product, although I could make it one if that the only way. But maybe more a document describing the part with a link to download the step file for it.

I can see this growing once I finally figure it out, like an entire download section, so trying to sort this out before I go about it the dumbest way I can find. Which is usually how things work out when I don't ask.

Link to comment
Share on other sites

Is the "digital download" the actual product (or service)? You say "no, don't think so", therefore it must be an auxiliary file that you then would mention in the product's description.

CubeCart has set aside the /files/ directory to hold those files that are the purchasable product. There is an .htaccess file in this folder that prohibits all HTTP requests for those files -- relying on CubeCart's download functionality (and recently "media steaming"), which is PHP code.

The declaration in that .htaccess file in /files/, which denies direct access by the web server, also includes sub-folders.

Except, the /public/ sub-folder, having its own .htaccess file, which allows direct access by the web server.

A direct link (www.example.com/files/public/info.pdf) will work for this file.

 

Link to comment
Share on other sites

So the link in my document to download the file would be https://myDomain.com/files/public/filename.stp

It would be a step file in this case. Then when the user click the link they would be presented with the option to download? Maybe worth noting their browser would not be able to display the file as it would a PDF or TXT for instance.

Am I correct here? I will also go check this right now.

Thanks Brian

That almost worked. But instead of allowing me to download it, when I click the link it displays the text in the browser. As if it were a picture or something. Was there something I needed to do to make it know to download it and not display it?

 

Link to comment
Share on other sites

I am not familiar with a "stp" MIME type. Neither, I would think, does any browser.

In the <a> tag, there is an attribute 'download'.

<a href="https://mydomain.com/files/public/filename.stp" download>The STP file</a>
  
See: https://caniuse.com/download
https://www.w3schools.com/tags/att_a_download.asp

 

Link to comment
Share on other sites

The "Link" dialog window offered by the CKEditor (product description, et al) has three tabs. The third tab, Advanced, has several form elements that all get put inside the <a> tag.

Only in the most recent versions of CubeCart has there been a CSS change that will permit the visibility of a checkbox at the left edge, on the last row above the green OK button. You might not see the actual checkbox, but by clicking on the phrase Force Download, the checkbox might get checked. (I haven't verified this.)

Please review:
https://github.com/cubecart/v6/issues/3368

 

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...