question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Always reload page after Files.insert()?

See original GitHub issue

I base on Meteor + Vue.

  • Meteor 1.7.0.5
  • Files 1.10.2
const Files = new FilesCollection({
  storagePath: () => {
    return `${Meteor.absolutePath}/fileUploads` // project path
  },
  collectionName: 'app_files',
})
// Vue tmp
<p>
      <img
        :src="filePreview"
        width="120px"
        height="125px"
      />
      <input
        ref="fileUploadHidden"
        type="file"
        accept="image/*"
        style="display: none"
        @change="filePicked"
      >
    </p>

    <el-button
      type="default"
      @click="pickFile"
    >Select file</el-button>
    <el-button
      type="primary"
      @click="uploadFile"
    >Upload file</el-button>
-----------
// Vue method
    uploadFile() {
      if (this.fileUpload) {
        Files.insert({
          file: this.fileUpload,
          streams: 'dynamic',
          chunkSize: 'dynamic',
          onUploaded(err, fileObj) {
            console.log('Upload', fileObj)
            if (err) {
              Notify.error({ message: 'File upload is error' })
            } else {
              Notify.success({ message: 'File upload is success' })
            }
          },
        })
      } else {
        Notify.error({ message: 'File upload is required' })
      }
    },

I tried to use @click.prevent="pickFile", still reload. Please help me.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thearabbitcommented, Oct 15, 2018

Very thanks again. It work fine 👍

1reaction
dr-dimitrucommented, Oct 14, 2018

@thearabbit read about navigation in Unix-like systems

I tried cd to Volumes on terminal

I don’t know your particular environment, all paths in my examples are pseudo-paths

Could advise should be use outside path, project path, ./meteor path…?

# outside
./meteor/../storagePath

# as we recommend:
/data/uploads

Create /data/uploads:

mkdir -p /data/uploads
chmod -R 777 /data
const Files = new FilesCollection({
  storagePath: () => {
    return '/data/uploads' // Mac, Ubuntu
    return 'C:\\data\\uploads' // Windows
  },
  collectionName: 'app_files',
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Always reload page after `Files.insert({...})` of `ostrio:files`?
I base on Meteor + Vue . It always reload page after Files.insert() . ```js const Files = new FilesCollection({ storagePath: () =>...
Read more >
One time page refresh after first page load - Stack Overflow
To refresh a page once each time it opens use: ... "reloadPage();" function in somewhere in your js file page will only be...
Read more >
How to Automatic Refresh a web page in fixed time
Approach 1: One can auto refresh the webpage using the meta tag within the head element of your HTML using the http-equiv property....
Read more >
How to Reload the Page | HTML Goodies
Most people know it can be done by hand by holding the shift key and clicking the “Refresh” (on IE) or “Reload” (on...
Read more >
Basic Features: Fast Refresh - Next.js
Next.js' Fast Refresh is a new hot reloading experience that gives you instantaneous feedback on edits made to your React components.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found