Jump to content

Godspeed! phi

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Godspeed! phi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello everyone, My problem may be simple, but I can't figure it out for the life of me. I have a form that has some text fields, text areas and radio buttons. I can submit those and insert a database record using AJAX just fine. But I also have some file input types. I realize that, since using true AJAX you must pass values via Javascript, it is either impossible or problematic to pass file inputs as parameters. So, I have been looking at a lot of online tutorials showing how to use IFrames. I've never dealt with them before. Yet, all of these tutorials show how to use an IFrame to upload files in sequence (without actually submitting a form as a whole). I only want the images to upload after the entire form submits and all fields validate. How do I do this? Any help would be appreciated.
  2. Hello all, I have a form that allows for multiple (no limit) file inputs. But, if the user forgets a field of the form and it brings them back to the form with an error, I need to bring the $_FILES values back with it. Hence, the form should be sticky, file inputs included. I created a static variable $tempFiles. I have the following line of code in my page: if($tempFiles!=null) $tempFiles+=$_FILES; else $tempFiles=$_FILES; I am trying to set $tempFiles equal to the array in $_FILES each time the page submits. But, if I already have array values in $tempFiles (from a previous page submit), I want the $_FILES values to be placed in the $tempFiles array. This way, when the page submits and hits no errors all files can be referenced in $tempFiles and uploaded successfully, instead of the user having to choose the files every time the page loads. Yet, when I write: print_r($tempFiles); exit(); The array of $tempFiles is printed, and is correct if it is the first page submit. But if it is the second, third, etc. the array only has one element, and it's ['name'], ['type'] and whatnot are blank. Can you copy over the values of $_FILES and then use them just as with $_FILES, or is this not allowed? Am I doing something wrong? Sorry if my explenation is difficult to read through. -Tim
  3. Hi. Thanks for the info. It seems to work out well.
  4. 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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.