I am trying to adjust my upload code to handle multiple uploads at the same time, I have searched and found all kinds of code that says to wrap my current upload scrypt inside of it and just change my file system to an array but every time I do I get an error so here is the code I am working with:
when I change <input name="file" type="file" /> to <input name="file" type="file" /> adding another couple of input fields and wrapping my upload script in the foreach code I get an error that says there is an error on line 10 of my upload.php which is this line $extension = end(explode(".", $_FILES["file"]["name"])); the error says that explode expects the forst paramiter to be an array and end expects the second paramiter to be a string, I understand what the error is telling me but I am not sure how to adjust the code to give it what it is wanting.
sorry I was wrong this is the error I keep getting
Warning: explode() expects parameter 2 to be string, array given in /home/test.com/upload.php on line 10
Warning: end() expects parameter 1 to be array, null given in /home/test.com/upload.php on line 10
yeah that doesnt work very well I got all kinds of errors thrown at me one of which was because the exif_imagetype() does not support .jpg and I need .jpg support because that is what gets uploaded onto the server most.
Shouldn't you be using $_FILES['file']['tmp_name'] instead of the actual filename? The filename $_FILES['file']['name'] is just a string, not a file. The file is uploaded to a temporary folder in php and named by $_FILES['file']['tmp_name'].
I actually just found a really good source that fixed the problem I was having, the foreach loop was the wrong loop, I needed a for loop and to use $_FILES['file' . $i]['name'] to get it done right.
@D Thanks I will be looking more into the exif_imagetype() for future projects that need that kind of security, this one however is the back end of the website and is not going to be accessed by the general public so anyone that uploads something harmfull will be hurting themselves.
only if I dont fix it, I plan to update the system once I have the code figured out at this time though I have my boss on my ### to just turn out what I have and worry about the rest later, so......I give him what I have and fix it right later on when he says I can, he's definitely no programmer and likes to pretend he knows more about it then anyone else.