Box 24

 Home   Infos   Tipps   Webmail   Humor   Polizei   Gästebuch   Downloads   Chat   Suchen   Feedback   Links 

 

 Anmelden/Login   Neuanmeldung/New User   Java Telnet Applet   Telnet   
 

Multiple file uploads

(since 5.4.449.5)

Added support for multiple uploaded files. To support this, we needed to come up with a method to determine the total file upload count and their true file names. The new mime extraction will now add unique name=value pairs for file uploads.

Example: 3 files are uploaded

  • x.zip
  • y.zip
  • z.zip

Typically, you will have the name=value pairs

  • controlname1=x.zip
  • controlname2=y.zip
  • controlname3=z.zip

where the controlnameX are defined by the HTML form developer.

The problem is that in order to support multiple file uploads in a general receiver server-side wcx, you have to customize the applet in order to get the control names.

This can be done generically. Now the WIN Server mime extractor will INCLUDE new name=value pairs to above name=value pairs defined by the FORM developer as follows:

mimefilecount=3

mimefile1=controlname1
controlname1=x.zip

mimefile2=controlname2
controlname2=y.zip

mimefile3=controlname3
controlname3=z.zip

This allows for an independent method of supporting a general file receiver system where the server-side applet does not really need to know the control name. The script can basically look for FileCount and if greater than 0, it can loop on "FileX" name to get the name of the control. You can then use this control name to get the real file name.

wcBASIC Example

// This example shows how to generically extract the file names
// of multiple uploaded files. HTTP POST request assumed which
// means paramstr(1) is the file name of the posted cached MIME
// file received by the WEB server.

dim fields as string = ""

if httpExtractMultipart(paramstr(1), TempPost+"upload.dat") then
  if GetParamsFromExtract(TempPost+"upload.dat",fields) then
   fields = HttpUnEscape(fields)
  end if
end if

dim fc as integer = GetParamInt(fields,"milefilecount",0)

print "total files : ";fc

for i = 1 to fc
  dim controlname as string
  dim filename as string
  controlname = GetParamstr(fields,"mimefile"+str(i))
  filename   = GetParamstr(fields,controlname)
  print controlname;"=";filename
next

© 2001 Hector Santos, http://www.santronics.com