We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38135
    • 6 Posts
    MODX Revolution 2.2.0-pl2 (traditional)

    I've successfuly set up and used fileupload 1.0.1 for uploading image files from the front end. It all works fine but I would like the facility to be able to rename a new file if it already exists on the server. I looked at the snippet code to see if there was anything straight forward I could modify but I'm reluctant to do this blind.

    I would also like to be able to create a thumbnail of the image file on the fly.

    Is there a straightforward way to do either of these things

    Thank you very much smiley
      • 38135
      • 6 Posts
      UPDATE

      I've installed PHPThumbof and sorted what I need to with thumbnails smiley

      Just need to sort the renaming of duplicate files 8-0
        • 38135
        • 6 Posts
        I've had a play with the upload snippet and added this code,
        //Handle the uploaded file
        $uploadfile = $path.basename($_FILES['userfile']['name'][$i]);
        $nametemp = pathinfo($uploadfile);
        $justname = $nametemp['filename'];
        $justname .= time();
        $extemp = pathinfo($uploadfile);
        $repex = $extemp['extension'];
        $uploadfile = $path.$justname.'.'.$repex;

        It works but I'm sure there must be a "nicer" solution. Any suggestions?

        :-)