Godspeed! phi Posted April 27, 2007 Share Posted April 27, 2007 Hello everyone. I'm trying to do something, and I'm not sure if it is at all possible. I created an HTML form for the user to write a blog post. I am allowing him to post images with the post, and I don't want a limit on the number of pictures. Here's how it works so far: 1) The user clicks on a button for 'Add an Image' 2) Javascript sets the button's style.display is set to 'none' (it's hidden) 3) Javascript creates a file input with a unique name, and 'next' button 4) The user uses the file input and selects an image and clicks 'next' 5) The newly created file input's style.display is set to 'none' (it's hidden) 6) The button's style.display is set to '' (it's visible) 7) Repeat So far this works. Using DOM the user can select as many images as he wants, but when I try to use PHP to process the form, $_FILES['input_name']['name'] doesn't return a value. Is the use of DOM to create file inputs on-the-fly the reason for this? And if so, does that mean that I can't do what I'm trying to do? Any suggestions? Thanks in advance Quote Link to comment Share on other sites More sharing options...
xenophobia Posted April 29, 2007 Share Posted April 29, 2007 Put your input name as: <input type="file" name=\"input_file[]\" /> So in your php, you refer $_POST['input_file'] as an array. foreach($_POST['input_file'] as $str){ echo $str . "<br />"; } I just post on my last thread same things.... Anyway hope this help you. Quote Link to comment Share on other sites More sharing options...
Godspeed! phi Posted May 4, 2007 Author Share Posted May 4, 2007 Hi. Thanks for the info. It seems to work out well. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.