Hello everyone,
I am fairly new to PHP (read a few tutorials, watched some videos on Lynda.com) and I am writing an admin script for a website trying to learn. Basically the client wants a form so he can update various news-type things, and also upload 4 pictures per article.
The 4 pictures is where I am getting stuck. I found a script to upload 1 image, but I'm not sure how to change the syntax to accept 4 forms.
Here is an example of what I am working with:
Code: Select all
<label for="file">Image 1:</label>
<input type="file" name="file" id="file" />
<label for="file2">Image 2:</label>
<input type="file" name="file2" id="file2" />
<label for="file3">Image 3:</label>
<input type="file" name="file3" id="file3" />
<label for="file4">Image 4:</label>
<input type="file" name="file4" id="file4" />Code: Select all
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 300000))I've done some googling and everything and I've read that $_FILES is a global array built into PHP, but I'm still a bit confused about how to add more than one key(?) to it in the context that I need to.
Thanks in advance! This is the last little hurdle of what I've done so far on this project and so far I'm really having fun with PHP. I've used it before (for includes mainly) but actually scripting stuff out can be really fun and I think once I get the hang of it, I won't be able to pull myself away from it.
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: