0

I’m a little frustrated because it took a very long time to get file upload working. I’m working with vue on the frontend and using meteor for backend. The file-upload is done using Meteor-Files from VeliovGroup. The uploading works without issues and the files are getting stored in the .meteor-Directory (default Directory of Meteor-Files) while the app is running in dev mode. But now, how can I get the images or other files I uploaded? The path that is stored in the FileCollection for each file is not right, if I use it for example for the src-attribute of an image. Is there something I’m missing? Is it simply not possible at dev mode?

I tried to set different storagePaths in the Meteor-Files-Settings, tried the "path" and the "link" attribute of the Fileobject in the FileCollection.

<div class="" v-for="Image in getImages">
   <img :src="Image.path" />
</div>
<!-- this is the Vue-Frontend where I'm trying to display the images, getImages is the FileCollection from Meteor-Files -->

I Just want to display or get my images, which I uploaded.

Thanks a lot in advance. If you need specific code snippets, just ask

Mario

  • Can you please add the function that resolved `getImages`? – Jankapunkt Nov 09 '19 at 14:44
  • `getImages() { return Images.find({}); }` The function just returns the FileCollection. The problem I have is, that the URL of the images doesn't work. So everything is stored right in the FileCollection and I can get the image-URL without any problems. But if I set the src="" of a image with that URL, the image could not be find. Even if I take the URL and put in in the browsers adress-box and hit enter, the image could not be find. – uncuerilla Nov 10 '19 at 18:47

2 Answers2

0

Does the same thing happen when you just hardcode the src for 1 file? I've had quite a lot of trouble dynamically binding to an img tag in the past. So I wonder, if you just replace <img :src="Image.path" /> with <img src="yourhardcodedfilepath" />, does the image then get displayed, or is it still not displaying correctly?

Reinier68
  • 2,450
  • 1
  • 23
  • 47
0

Okay, I took the wrong absolute path for the config.storagePath. Now it works with the right absolute path. But I still can't access uploaded files in dev, that have been uploaded to the relative path in the temporary build-folder. But I think, I can do a workaround for that.