Search The ForumSearch   RegisterRegister  LoginLogin

MailBee SMTP

 AfterLogic Forum : MailBee SMTP
Subject Topic: Multiple E-Mail Attachments Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
nwebster
Newbie
Newbie


Joined: 12 April 2005
Location: United States
Online Status: Offline
Posts: 9
Posted: 08 September 2005 at 3:11pm | IP Logged Quote nwebster

Do you have any sample or example of how to do multiple file uploads on the same page and loaded into different directories? I thought I had seen one before, but can't seem to find it now.
Back to Top View nwebster's Profile Search for other posts by nwebster
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 08 September 2005 at 3:34pm | IP Logged Quote Alex

This sample saves all files into C:\Temp folder. You can easily modify it to save each file into separate folder, such as use variable instead of a constant for DirPath parameter, or build this DirPath dynamically for each file.

The most important thing is that Uploader object keeps all files in memory until you save them. Thus, no temporary files are created, and each file is saved only if it SaveToDisk method was called for that file.
Code:

<% Set Uploader = Server.CreateObject("MailBee.Uploader")
Uploader.ParseRequest Request.BinaryRead(Request.TotalBytes)
If (Uploader.FormElements.Count <> 0) Then
   Set File = Uploader.FormFiles(Uploader.FormFiles.Count)
   File.SaveToDisk "C:\Temp\", "type the new file name here"
End If %>


Original HTML form which posts data to the page above must have enctype="multipart/form-data" in FORM tag and contain at least one <input type=file> element inside <FORM>...</FORM>.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
nwebster
Newbie
Newbie


Joined: 12 April 2005
Location: United States
Online Status: Offline
Posts: 9
Posted: 08 September 2005 at 3:41pm | IP Logged Quote nwebster

Thanks. Do you know of a way to add a new file input each time a file is uploaded? i.e. if I see one upload option there, press browse and select a file, then it presents a second upload field option, and so on...
Back to Top View nwebster's Profile Search for other posts by nwebster
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 10 September 2005 at 12:37pm | IP Logged Quote Alex

Mainly it's a question of javascript programming on the client (not server) side.

For example, you can place file upload controls into <TABLE>, and attach onclick handler to <INPUT TYPE=FILE> control. Each time onclick fires, add new row containing new file control (with onlick handler set) to the table.

You may also check if all already existing file controls have not-empty ".value" property to avoid adding new file controls if there is no shortage of empty file upload slots.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide