brettpower Posted January 17, 2007 Share Posted January 17, 2007 I want to have a section of my admin interface inform a user if a file does or does not exist.Basically I want to have the page echo "YES" if the image exists or echo a link to upload the image if it does not exist.Any ideas? Link to comment https://forums.phpfreaks.com/topic/34618-php-syntax/ Share on other sites More sharing options...
utexas_pjm Posted January 17, 2007 Share Posted January 17, 2007 http://us2.php.net/function.file-exists Link to comment https://forums.phpfreaks.com/topic/34618-php-syntax/#findComment-163087 Share on other sites More sharing options...
brettpower Posted January 17, 2007 Author Share Posted January 17, 2007 That is exactly what i need, however, I can't get the syntax right.[code]<?php$filename = ../uploads/xxxxxx.gif';if (file_exists($filename)) { echo "";} else { echo "";}?> [/code]I have an existing variable ( $row_Upload['campaign'] ) that pulls a campaing ID number that is used on several parts of the page. The file that I want to verify the existance of is simply the variable with .gif added onto the end. I can't figure out how to plunk my existing variable into line 1 of the above code with .gif on the end to get the code to work.Also, if the file does exist, I want a hyperlink to ../uploads/xxxxxx.gif, and if the file is not found, a hyperlink to ../file_upload.php.If anyone understands what the heck I need, please help.Thanks. Link to comment https://forums.phpfreaks.com/topic/34618-php-syntax/#findComment-163264 Share on other sites More sharing options...
fert Posted January 17, 2007 Share Posted January 17, 2007 [code]$filename = "../uploads/xxxxxx.gif";[/code] Link to comment https://forums.phpfreaks.com/topic/34618-php-syntax/#findComment-163267 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.