1 Reply Latest reply on Aug 8, 2008 1:43 PM by Günter Schenk

    How to allow all types of uploads?

      Is there a way to make it so when a user uploads/downloads a file I can just set ->setAllowedExtensions("All") and it will allow for everything? If you comment out the line it doesnt work and I dont want to create a long array every time like setAllowedExtensions("doc, pdf, csv, xls, rtf, sxw, odt, zip, txt, rar, tif, tiff, jpg, jpeg, ppt");
        • 1. Re: How to allow all types of uploads?
          Günter Schenk Level 4
          Hi Brad,

          regretfully there´s no "all" option available, and adding it would require to rewrite the libraries - so, no ;-)

          --------
          I dont want to create a long array every time
          --------

          As you will have to provide an array, here´s an alternate approach:

          1. define an array of allowed extension in a separate PHP file like this: $allowed_extensions = "doc, pdf, csv, xls, rtf, sxw, odt, zip, txt, rar, tif, tiff, jpg, jpeg, ppt"; -- and include this file in all your file upload pages in order to get access to the contents of the $allowed_extensions variable.

          2. let´s modify the default Trigger_FileUpload function. As it´s a PHP function which needs to access an external variable, declare the $allowed_extensions variable as GLOBAL:

          function Trigger_FileUpload(&$tNG) {
          global $allowed_extensions;

          3. let´s now try to use this variable rather than the default hard-coded values, like this:

          $uploadObj->setAllowedExtensions("".$allowed_extensions."");

          Works ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver