Meteor-files: Files corrupted on download

Created on 27 Mar 2018  路  9Comments  路  Source: veliovgroup/Meteor-Files

  • Version of Meteor-Files latest
  • Version of Meteor 1.6.1
  • Browser name and its version? Every
  • I'm using filesystem upload (default)

The files are uploaded properly, I can open them from the upload folder where they are uploaded without issue.
However using this code to download the file starts the download properly but the size of the downloaded file is similar "not equal" to the file in the upload folder (sometimes bigger). I can't open the file, office/adobe says the file is corrupted. Images are currupted too.

<a href="{{link}}?download=true" download="{{name}}" target="_parent">T茅l茅charger</a>

.link() question

Most helpful comment

To have access to all features you should iterate using .each property:

{{#each communiques.each}}
  <a class="list-group-item" href="{{link}}?download=true" download="{{name}}" target="_parent">
    <i class="fa fa-file-pdf-o fa-fw"></i> {{ meta.nom }}
  </a>
{{/each}}

All 9 comments

Hello @FrancisBou ,

We need more info:

  1. Screenshot of "Network" tab in DevTool where downloaded file is selected and "Headers" section is visible
  2. Please, post contents of .meteor/packages file

Hi dr-dimitru,

Unfortunalety I can't get the download to show in the network tab, I've got no filter and "all" is selected, recording is on ,not sure why it's not there.

package file

[email protected]
[email protected]
[email protected]
[email protected] 
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
accounts-base
accounts-password
useraccounts:bootstrap
accounts-ui
percolate:migrations
alanning:roles
kadira:flow-router
kadira:blaze-layout
session
arillo:flow-router-helpers
aldeed:template-extension
mdg:validated-method
mdg:validation-error
aldeed:simple-schema
aldeed:collection2
msavin:sjobs
http
percolate:paginated-subscription
ostrio:files

@FrancisBou , thank you for update.

  1. Okay, you always can do curl -v "http://localhost:3000/link/to/the/file"
  2. Move ostrio:files to the line __above__ kadira:flow-router - This should solve the issue

Let me know if it helped.

It seems that the link method returns an empty value, the downloaded file is in fact HTML, that's a bit embarassing! I saw you can use the "fileURL" helper and it works. Thanks so much @dr-dimitru

@FrancisBou link should work too. But it depends from how you iterate over the cursor.
Could you share your HTML+Blaze Template code?

I iterate using each:

{{#each communiques}}
  <a class="list-group-item" href="{{link}}?download=true" download="{{name}}" target="_parent">
    <i class="fa fa-file-pdf-o fa-fw"></i> {{ meta.nom }}
  </a>
{{/each}}
Template.communiques.helpers({
  communiques() {
    return Communiques.find({});
  }
});

To have access to all features you should iterate using .each property:

{{#each communiques.each}}
  <a class="list-group-item" href="{{link}}?download=true" download="{{name}}" target="_parent">
    <i class="fa fa-file-pdf-o fa-fw"></i> {{ meta.nom }}
  </a>
{{/each}}

@dr-dimitru I should have read more carefully, thanks for the help!

Please, support this project by:

Was this page helpful?
0 / 5 - 0 ratings