I'm trying to streamline the entire image uploading routine by putting all of the error handling, image renaming, and uploading into a separate function. I wrongly assumed that I could just have the form post to the same page, and then call the function and within the function, the $_FILES information from the upload would all be there. But it isn't.
I'm passing variables into the function such as where I want the image to be uploaded, the size of the image when resized, etc..., but I don't know how to pass in a $_FILES array.
The variables I'm using in the function are $_FILES['images']['name'] and $_FILES['images']['tmp_name']
Now I realize I could just pass those variables in, BUT the problem is that this allows for multiple image uploads, and within the function it cycles through the $_FILES array.
Any suggestions on how to turn image/file uploading into a function?