Attach files<

windows

Guest
I know there are a lot of threads on attachments, and I have done attachments in the past, but this time I want something different. I would like to have one browse feild and an attach button. I would like to be able to attach multiple files one at a time, but I don't want it to actually upload them each time I hit attach. I would rather have it happen instantly and show the files that will be attached and then when you hit submit finally it will send all the files you have attached.

I'm not sure if this is possible. The other route I guess is to have it upload to a temp directory and then move the files after user submits, but then there is a pause for uploading between each attach. Any ideas?Hmmm... My only idea: may be you should use smth like ActiveX components???have multiple browse button in the same form...I have multiple browse buttons, but I would like it better if I could have one. Don't want to use active-x. :p

Oh well, I'll just have to stick with multiple fields.hmmm

maybe with some javascript.

have 1 input file for the current file.

have an x number of input file in an hidden div.

have some javascript when the user click "ok" to copy the current file into an hidden one and clear the current one.I'm not big on javascript solutions because a lot of people disable javascript. :( Damn pop ups and no pop up blocker in IE is the cause for this I think.Well, there is one part that I don't know how to do, but hopefully this will put someone on the right track.

You could make 2 seperate forms. One that has the submit button (to actually send the message and files), with an outside php file for the action. Then have a form that has an Add File button and a text input, with the current php document as the action.

Say you want no more than 10 attachments (in theory you could use loops to have as many files as you want, but I would set a max).

Have 10 hidden "file" Input's (hide them with style="visibility:hidden;") in the main form.

Then when a file is submitted with the Add File Button, have the current file add it to an array.

Have each of the 10 hidden file fields have a value="<?php echo files_array[0]; ?> and of course increment the red 0 (0-9).

The thing that I DON'T know how to do is make a browse button for a text type input (that will look, and act like the browse button for a file type input).Originally posted by ianmh
I have multiple browse buttons, but I would like it better if I could have one. Don't want to use active-x. :p

Oh well, I'll just have to stick with multiple fields.
if you only have one then you have to upload each and every one where as if you do a lot then 1 upload will do all of them at once.I will do it that way. Can I loop through a files array the same way I could with any array? I'll have to try when I get home. :)yup, it works just like an array. :)
 
Back
Top