note 78015 deleted from function.move-uploaded-file by ezyang

From: Date: Mon, 24 Sep 2007 23:55:54 +0000
Subject: note 78015 deleted from function.move-uploaded-file by ezyang
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-130759@lists.php.net to get a copy of this message
Note Submitter: steviedifranco at ohioconnect dot net Reason: useless ---- If you are handling a file upload with move_uploaded_file and you want to get the file extension, I've seen examples using 'explode()', but you may run into problems if the file uses a period in the name. For example, if the uploaded file name is "this.video.file.mpg" and if you do an explode(), you'll get an array of 4 different values. To be safe, do a substr_count() ahead of the explode(), like this: $uploadedFileName = $_FILES['videoFile']['name'] ; $periodNum = substr_count($uploadedFileName, '.') ; $uploadedExplode = explode('.', $uploadedFileName) ; $fileExtension = $uploadedExplode[$periodNum] ;

« previous php.notes (#130759) next »