We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34193
    • 330 Posts
    Has any one out there modified either of these two snippits so the user can chose from a list of 4 or 5 directories to upload to depending on what they are uploading IE a docs folder, an image folder etc...

    If so how did you do it can you post your code.

    If not I will look into editing one of the snippits to try and allow this, but if someone has all ready done then will save me a lot of time.
      • 34193
      • 330 Posts
      OK. guessing no one so far then. Have a little time available tonight will have a look at the script and see if I can sort it. Will post here with any success or problems.
        • 34193
        • 330 Posts
        OK this turned out to be simpler than I thought. Below is what I did. I used FileUpload I didn’t need the extra features supplied by FancyUpload.

        So first down load FileUpload snippit open snippet.fileupload_v1.0.txt in a text editor

        find
        /* -------------- No configurable stuff below this line ------------ */
        // Setup the defaults
        if (!isset($tpl))          return $_fu_lang['error_no_tpl'];
        if (!isset($path))         return $_fu_lang['error_no_path'];
        if (!isset($maxsize))      $maxsize = 1048576; // In bytes (1 megabyte)
        if (!isset($uploadgroups)) $uploadgroups = '';
        if (!isset($extensions))   $extensions = 'zip,jpg';
        if (!isset($createpath))   $createpath = 0;


        Add
        if (isset($_POST['path'])) $path = $_POST['path'];
        after the // Setup the defaults.

        Now open the uploadform template you want to use in a text editor.

        find
        <table>
        
            <tr><td>First file:</td><td><input name="userfile[]" type="file" /></td></tr>


        and change to
        <table>
        
            <tr><td>Folder:</td><td><select name="path">
          <option>/Firstdirectory/</option>
          <option>/Firstdirectory/Sub1/</option>
          <option>/Firstdirectory/Sub2/</option>
          <option>/Secinddirectory/</option>
          <option>/Thirddirectory/Sub1/</option>
          <option>/Thirddirectory/Sub2/</option>
          <option>/Thirddirectory/Sub3/</option>
        </select></td></tr>
            <tr><td>First file:</td><td><input name="userfile[]" type="file" /></td></tr>


        Now follow the install instructions as per the snippit but using the new code.
        You will still need to specify the &path=`Firstdirectory` as part of the snippit call as it defaults to this if no directory chosen.

        Hope this helps others

          • 5340
          • 1,624 Posts
          First test with fancy upload

          The page I’m using it for, isn’t public. belongs to a group "Upload"
          Snippet: [!FancyUpload? &extensions=`jpg` &maxsize=`52428800` &insertmootools=`1`!]

          The page is not cached

          When uploading I get "Upload failed (401)". What’s this error for?

          The strage thing is that if I use it like: no mootols at all
          [!FancyUpload? &extensions=`jpg` &maxsize=`52428800` !]

          it works:the image is uploaded to files folder.
          Offcourse I get the javascript errors that the required js are not there but it works. Also I get no confirmation message.


          Thx for your help