1

I have a problem on my side.

So I created a script that upload resize and upload files on a server : /tmp/117x117/6.jpg.

In the template I have :

<img src="{{ record.image_path }}" alt="" style="width: 50% !important;"/>

I look in the source of the page and in src of this image I have /tmp/117x117/6.jpg and the image is not shown.

Can you help me please ? Where's the error?

Thanks in advance and sorry for my english.

SaintLike
  • 9,119
  • 11
  • 39
  • 69
Harea Costicla
  • 797
  • 3
  • 9
  • 20
  • did you tried to access the image directly? localhost/tmp/117x117/6.jpg .. I'm pretty sure there are some permissions which must be granted for that directory – Mihai Matei Dec 14 '15 at 14:38
  • 4
    Note that`/tmp` is a _temporary location_. It might be that the image has already been removed again. That location is typically used during file upload, but the file will be removed (deleted) from there when the upload is finished and processed. You have to copy / move the file to a final location to be able to use it persistently. – arkascha Dec 14 '15 at 14:40
  • I have down voted your question because of lack of documenting prior to posting the question and lacking basic knowledge of web development (i.e. where will the web server look for documents to serve to the browser) – Dragos Dec 14 '15 at 14:58
  • `chmod 777 /tmp/117x117/6.jpg` – online Thomas Dec 14 '15 at 14:58
  • @Thomas your answer is extremely WRONG. You are advising someone to perform actions on a OS temporary folder in order to solve a web app specific problem. – Dragos Dec 14 '15 at 15:00

1 Answers1

1

After uploading the file (image) you should also move the file in the document root folder of the web server.

Please read the PHP documentation for uploading files And check the method: move_uploaded_file()

Dragos
  • 1,824
  • 16
  • 19