Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: File Uploads not working #30

Closed
mr-karan opened this issue Oct 25, 2019 · 10 comments
Closed

Bug: File Uploads not working #30

mr-karan opened this issue Oct 25, 2019 · 10 comments
Labels
bug Something isn't working

Comments

@mr-karan
Copy link
Collaborator

mr-karan commented Oct 25, 2019

Steps to reproduce

  • Downloaded the latest release from github:
    curl -sL https://github.com/knadh/listmonk/releases/download/v0.2.2-alpha/listmonk_0.2.2-alpha_linux_amd64.tar.gz | tar xz

  • Created a new config file
    ./listmonk --new-config

  • Spawned an ephemeral postgres container
    docker run -p 5432:5432 -e "POSTGRES_DB=listmonk" -e "POSTGRES_USER=listmonk" -e "POSTGRES_PASSWORD=listmonk" postgres:latest

  • Configured DB
    ./listmonk --install

  • Created an uploads folder in the current directory
    mkdir uploads

  • Started listmonk
    ./listmonk

  • Visited http://localhost:9000/campaigns/media and uploaded a file
    DeepinScreenshot_select-area_20191025131954

What happened
Got a 404 on the uploaded file. http://localhost:9000/uploads/DeepinScreenshot_select-area_20191009181805.png

Expected scenario
The file should have been previewed correctly, not 404.

@mr-karan
Copy link
Collaborator Author

Figured. Looks like a typo here
should have been: srv.Static(c.UploadURI, c.UploadPath)

Will send a patch with #22 ?

@knadh
Copy link
Owner

knadh commented Oct 25, 2019

Yep, looks like it's a typo. I'm not sure how it's working in production though.

@3sigma-devops
Copy link

error uploading file: open uploads/profile_logo_UVBGW_a5c39e85beb37d2090c7ab84b9b12381.jpg: no such file or directory
2021/09/08 08:20:38error uploading file: open uploads/FireShot Capture 109 - threesigma-backend-production · Metrics - Heroku - dashboard.heroku.com.png: no such file or directory

I am facing this same issue while uploading media

@knadh
Copy link
Owner

knadh commented Sep 8, 2021

Have you mounted a filesystem and made an uploads directory and set that path in the upload settings? On an ordinary Linux server, this would be straight forward, but on Heroku, you've to do this manually.

@ntmoin
Copy link

ntmoin commented Jan 21, 2022

Hi, Knadh,
Good day!
I have installed several times the listmonk latest version following/using___

mkdir listmonk && cd listmonk
sh -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-prod.sh)"
Visit http://localhost:9000.

Anyway, each and everytime I am facing the same file upload error as___

Error uploading file: open /root/listmonk/uploads/emailsecurityconciousness.jpg: no such file or directory

Yes of course in my ubuntu 20.04 machine I have created the 'uploads' directory in my project directory. Like_
Project path: /root/listmonk
Upload folder: /root/listmonk/uploads

Please help for the resolution.

@ntmoin
Copy link

ntmoin commented Jan 21, 2022

image
image
image
image

@knadh
Copy link
Owner

knadh commented Jan 21, 2022

Looks like the directory is not mounted in the container. @mr-karan would you be able to take a look?

@mr-karan
Copy link
Collaborator Author

mr-karan commented Jan 21, 2022

Yeah, /root/listmonk/uploads/ is the path inside container, which likely doesn't exist.

You'll need to mount the upload folder to the container. Edit this in your docker-compose:

    volumes:
    - ./path/on/your/host/:/path/inside/container

The value of path/inside/container is the one you should use in the Listmonk settings. This will ensure that the files uploaded are persistent.

@ntmoin
Copy link

ntmoin commented Jan 26, 2022

Thank you so much 'Mr. knadh' & 'Mr. mr-karan'.

@MaximilianKohler
Copy link
Contributor

MaximilianKohler commented Aug 6, 2023

Yeah, /root/listmonk/uploads/ is the path inside container, which likely doesn't exist.

You'll need to mount the upload folder to the container. Edit this in your docker-compose:

    volumes:
    - ./path/on/your/host/:/path/inside/container

The value of path/inside/container is the one you should use in the Listmonk settings. This will ensure that the files uploaded are persistent.

Per the docs I'm using this:

services:
  app:
    <<: *app-defaults
    container_name: listmonk_app
    depends_on:
      - db
    volumes:
      - ./config.toml:/listmonk/config.toml
      - type: volume
        source: listmonk-uploads
        target: /listmonk/uploads

volumes:
  listmonk-data:
  listmonk-uploads:

Are you saying we should use one or both of these?:

services:
  app:
    <<: *app-defaults
    container_name: listmonk_app
    depends_on:
      - db
    volumes:
      - ./config.toml:/listmonk/config.toml
      - ./home/ubuntu/listmonk/uploads:/listmonk/uploads

volumes:
  listmonk-data:
  - ./home/ubuntu/listmonk/uploads:/listmonk/uploads

Also, the docs show this (no period and one space indent):

    volumes:
      - /data/uploads:/listmonk/uploads

And you say:

    volumes:
    - ./path/on/your/host/:/path/inside/container

EDIT: mostly solved here: #1169 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants