[opencms-dev] Fw: Website user uploading files to be emailed

Arian Abrahantes Quintana Arian.Abrahantes.Quintana at cern.ch
Tue Jul 5 08:57:14 CEST 2005


hi
 
A friend of mine did it once but in opencms5.0 don't know for opencms6 will it work since a few things have changed. If this could help you try something like -just refined it's a bit bizarre but works-:
 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
  Enumeration files = cms.getRequestContext().getRequest().getFileNames(); 
  String path = File.separator + "path" + File.separator + "to" + File.separator + "write" + File.separator + "In" ;
  File dir = new File(path);
  String[] list = dir.list();
  int n = 0;
  while(files.hasMoreElements()){
       String filename = (String)files.nextElement();
       if(filename.equals("unknown")){
          n++;
          out.println("You don't upload a file in the form, please ");
       }
       if(n==0){
          // verify equals names
          for(int i=0; i<list.length; i++){
             // Get list name
              String listname = list[i];
              if(filename.equals(listname)){
                 n++;
                break;
              }
          }
          if(n != 0) out.println("There is a file with the same name, please change your file name and "); 
        }
       if(n==0){
          String filepath = path + File.separator + filename;
          // create a file in the filesystem
          File file = new File(filepath);
          byte[] filecontent = cms.getRequestContext().getRequest().getFile(filename);
          OutputStream output = new FileOutputStream(file);
          // transfer bytes to file
          output.write(filecontent);
          output.close();
       }
  }
 
*******************************************************************************************************
 
My friend had to choose this way since he had some problems with the regular procedure -SOME PARAMETER HARDWIRED IN MYSQL- of uploadin files bigger than 12 MB.
 
Regarding mail somebody I posted in http://mail.opencms.org/pipermail/opencms-dev/2005q2/017988.html something about it.
 
Please remember that these are hints in Opencms5, ok?
 
hope it helps. Regards,
 
arian

________________________________

From: opencms-dev-bounces at opencms.org on behalf of James Adams
Sent: Tue 7/5/2005 1:59 AM
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Fw: Website user uploading files to be emailed



Has anybody ever done this ?

regards

James

----- Original Message -----
From: "James Adams" <james at gamepub.com>
To: "The OpenCms mailing list" <opencms-dev at opencms.org>
Sent: Monday, July 04, 2005 2:35 PM
Subject: [opencms-dev] Fw: Website user uploading files to be emailed


> Has anyone got an example of website user upload code that works with
> opencms?
>
>> I'm trying to implement a a form where users can upload a file + message
>> to the server which I then email on to a specific email address.  How
>> should I do that?  Old upload code I've used on other Jsp projects
>> doesn't seem to work as the request object is of type
>> org.opencms.flex.CmsFlexRequest.   This returns null when I try and query
>> the content type.  Any example code I could use?
>
> thanks in advance
>
> James
>
>
> ----- Original Message -----
> From: "James Adams" <james at gamepub.com>
> To: "The OpenCms mailing list" <opencms-dev at opencms.org>
> Sent: Monday, July 04, 2005 8:58 AM
> Subject: Website user uploading files to be emailed
>
>
>> Hi all,
>>
>> First off thanks to all the people from Alkacon for the on time release
>> of Opencms 6.0 and good response from people on this mailing list.  I'm
>> sure Opencms will go from strength to strength over the next few years.
>>
>> I'm trying to implement a a form where users can upload a file + message
>> to the server which I then email on to a specific email address.  How
>> should I do that?  Old upload code I've used on other Jsp project doesn't
>> seem to work as the request object is of type
>> org.opencms.flex.CmsFlexRequest.   Any example code I could use?
>>
>> best wishes
>>
>> James
>>
>>
>
>
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.323 / Virus Database: 267.8.8/37 - Release Date: 01/07/2005
>
>



_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://mail.opencms.org/mailman/listinfo/opencms-dev


-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 9917 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050705/1af99ce1/attachment.bin>


More information about the opencms-dev mailing list