Reputation: 1129
I have some code that needs to see if a file has been selected before it runs the code .... its pretty simple code, its just not working for some reason and i cant see why. my code is as follows
if(isset($_FILES['filename'])){
$directory = 'uploads/'.substr(md5(microtime() * mktime()),0,15);
if(!is_dir($directory)){
mkdir($directory, 0777, TRUE);
chmod($directory, 0777);
}
}
I have multiple file fields which are coded like so:
<input class="file-input" name="filename[]" type="file" size="32" />
When i move the code OUTSIDE the 'if(isset......' block, it works perfect .... just not inside it, and thats where i need it.
Can anyone see where im going wrong?
Upvotes: 0
Views: 224
Reputation: 1129
Oh dear .... I figured the problem.
Yes thats right folks .... I forgot to change the type of form to multipart.
Feel free to throw things at me!!!
Thanks anyways guys!
Upvotes: 1