0

I'm new in php, now I'm working on a website in which there is one problem occuring in email form.

I want to attach more than one file as attachments (for this task i got required code).

I have one browse button, but I'm not getting what code I have to write there for invoking required file/directory/folder,(when I click on browse button one window is open from which I take single file at a time, like gmail compose email form).

I think you understand what I want to tell you (I'm not having well communication).

Thanking You in Advance

alain.janinm
  • 19,951
  • 10
  • 65
  • 112
amol
  • 47
  • 1
  • 2
  • 10

1 Answers1

0

Amol, simple procedure to accomplish this is to provide multiple file upload controls on your form like:

<input type="file" name="file1">
<input type="file" name="file2">
<input type="file" name="file3">
.
.
.
<input type="file" name="file10">

On server side you can iterate over all $_FILES to see how many files were actually uploaded and process them accordingly.

Advanced methods include using an ajax or flash uploader to upload multiple files asynchronously; storing them in a temporary folder and storing list of uploaded files in SESSION. When the send button is clicked, you can process that SESSION variable to determine how many files were attached to the email being composed and process accordingly.

I am sure whatever file attachment script you're using supports attaching more than one file.

Salman A
  • 262,204
  • 82
  • 430
  • 521