---
title: "Hur fungerar file_exists?"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/15303-hur-fungerar-file-exists"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "Qonos"
published: "2001-02-25T10:20:00.000Z"
updated: "2001-02-25T12:57:00.000Z"
replies: 2
views: 160
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/15303-hur-fungerar-file-exists"
---

# Hur fungerar file_exists?

## #1 — Qonos, 2001-02-25T10:20Z

inte så här iaf :o(

\<?php 
if(!file_exists($row\[id\].".jpg"))
echo'	\<img src="home/'.$row\[id\].'.jpg" width="80" border="0" alt="" hspace="8" vspace="3"\>\<br\>';
?\>

Permalänk: https://www.webforum.nu/p/15303

## #2 — Fuel, 2001-02-25T12:46Z

Så här kanske ?

\<?
$min_bild = $row\[id\];

if(file_exists($min_bild.jpg")) { 
echo " \<img src=\\"home/$min\_ bild.jpg\\" width=\\"80\\" border=\\"0\\" alt=\\"\\" hspace=\\"8\\" vspace=\\"3\\"\>\<br\>";
} else { 
echo " \<img src=\\"home/standard.jpg\\" width=\\"80\\" border=\\"0\\" alt=\\"finns inte\\" hspace=\\"8\\" vspace=\\"3\\"\>\<br\>";
}
?\>

Permalänk: https://www.webforum.nu/p/317326

## #3 — Qonos, 2001-02-25T12:57Z

\<?
$min_bild = 'home/'.$row\[id\].'.jpg';

if(file_exists($min_bild)) { 
echo " \<img src=\\"$min_bild\\" width=\\"80\\" border=\\"0\\" alt=\\"\\" hspace=\\"8\\" vspace=\\"3\\"\>\<br\>";
} else { 
echo " \<img src=\\"home/standard.jpg\\" width=\\"80\\" border=\\"0\\" alt=\\"finns inte\\" hspace=\\"8\\" vspace=\\"3\\"\>\<br\>";
}
?\>

fick fixa lite med det, men nu fungerar det... tackar

Permalänk: https://www.webforum.nu/p/317327

---

Tråden på webben: https://www.webforum.nu/amne/php/15303-hur-fungerar-file-exists
