Announcement

Collapse
No announcement yet.

Can I specify files to upload to a website from within Actinic HTML code?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Can I specify files to upload to a website from within Actinic HTML code?

    Is there any way to upload product images to a website from within Actinic, without specifying them individually as variables with a type = filename , or in the additional files list.

    These files exist in subfolders within the site.

    What I want to be able to do is set a variable for a filename, lets say "productx", and how many images there are, lets say "5" and for the system to upload productx-1-t.jpg through to productx-5-t.jpg.

    I can use PHP to sort out the filenames for me and to upload them if they are in the site 1 folder but not from subfolders.
    Regards
    David

    #2
    If Actinic sees code like <img src="subfolder/myfile.jpg"/> then it will automatically upload the file and convert the code to <img src="myfile.jpg"/> when saving it on the live site.

    It's really only the src="subfolder/myfile.jpg" that's being detected so it may be possible to fudge the upload by generating something like

    <script>
    src="subfolder/myfile.jpg";
    src="anotherfolder/anotherfile.jpg";
    </script>

    Which happens to be valid JavaScript (which does nothing) but also looks like a src="..." taglet to Actinic.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      P.S. If loading filenames that may contain paths into PHP from a Variable then it's best to use
      Code:
      $image = str_replace('\\', '/', '<actinic:variable name="MyImage" encoding="perl" selectable="false" />');
      To convert backslashes into forward ones.

      Otherwise, those Windows supplied backslashes can cause havoc if your filename is eventually being used in a JavaScript. The path is still present when Previewing. Code may appear to work but if someone subequently puts an image in a sub-folder where the folder or file name begins with escapable characters (images\new\thisfile.jpg) then part of this string will look like \n and \t and will break the filename. The bit of PHP above fixes that.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Cheers for that Norman - I'll give it a go.
        Regards
        David

        Comment

        Working...
        X