Reply to file exists problem

Your name:

Reply:


Posted by Karl on 01/02/08 19:10

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 = "";
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация