file exists problem
- From: Karl <karlarneg@xxxxxxxx>
- Date: Wed, 2 Jan 2008 11:10:43 -0800 (PST)
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.
Karl
// *** Nyhets Bilde ***
if (isset($_FILES['nyhets_bilde']) &&
($_FILES['nyhets_bilde']['error'] == UPLOAD_ERR_OK)) {
$bildesti = '../nyheter/' . basename($_FILES['nyhets_bilde']
['name']);
} else {
$bildenavn = basename($_FILES['nyhets_bilde']['name']);
if(move_uploaded_file($_FILES['nyhets_bilde']['tmp_name'],
$bildesti)) {
} else {
$nyhets_bilde = "$bildenavn";
} else {
$nyhets_bilde = "Kunne ikke flytte bilde til $bildesti";
}
} else {
$nyhets_bilde = "";
}
.
- Prev by Date: Re: Last Day of Year Date Bug?
- Next by Date: Re: deleting cookies and local browser time versus server time
- Previous by thread: Re: Relative paths in require_once problem (possibly all include routines)
- Next by thread: PHP read from file on server
- Index(es):