1

I'm uploading an image using Flask-Uploads. File uploads to the folder imginside the app folder. So the paths is 'app/img/'.

Flask-Uploads setup:

app.config['UPLOADED_IMG_DEST']='img'
photos = UploadSet('img', IMAGES)
configure_uploads(app, photos)

Files saves successfully and return url:

filename = photos.save(image)
url = photos.url(filename)

URL: http://example.com:5000/_uploads/img/cb6b8061-0b9f-47a6-b4b0-d2212b97a8b3.jpg

Image name generated randomly and picture is in the 'img' directory.

When I'm trying to access the link, or put it in <img src"...> it returns 404 Not Found

TRIED: without _updates in the path

Any suggestions? Thanks in advance.

Oleg Somov
  • 815
  • 1
  • 13
  • 20
  • so you want to serve static files? `send_static_file` and `send_from_directory` can be used i guess to fix your problem. – senaps Jan 30 '18 at 06:42
  • @senaps I tried send_from_directory and it was working, but it returns the file, whereas I need a link to the file, because I'm using js to change image on the page. But thanks for comment – Oleg Somov Jan 30 '18 at 13:06

0 Answers0