By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,805 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

file exists problem

P: n/a
Hello again.
I use this file-upload example below. But I want to check if a file
exists. I have tried to put the file_exists() function inside of this.
But it did not work well..

(The example below is taken from Oreillys PHP Cookbook and it work
nice. But it overwrite existing files and I like to receive an error
and protect files on the server from this.)

Thanks for all advice.


// *** Nyhets Bilde ***
if (isset($_FILES['nyhets_bilde']) &&
($_FILES['nyhets_bilde']['error'] == UPLOAD_ERR_OK)) {
$bildesti = '../nyheter/' . basename($_FILES['nyhets_bilde']
} else {
$bildenavn = basename($_FILES['nyhets_bilde']['name']);
$bildesti)) {
} else {
$nyhets_bilde = "$bildenavn";
} else {
$nyhets_bilde = "Kunne ikke flytte bilde til $bildesti";
} else {
$nyhets_bilde = "";
Jan 2 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.