Announcement

Collapse
No announcement yet.

Filename in Variables

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

    Filename in Variables

    Hi,

    I was planning on using a variable which contains a Filename (so I can attach datasheets/brochures etc to the item). I browse for the item and upload but when I look on the website, it is showing the local file name. Is this correct or do I need to change something to make actinic upload.

    Thanks,
    Paul.

    #2
    Paul,

    Am looking into this one for you.

    Kind regards,
    Bruce King
    SellerDeck

    Comment


      #3
      Hi Paul,

      In you would need to include your variable in the link code to those documents, ie:

      <a href="variablename">click here to view document</a>

      If you want the contents of the file to display on the page then you need to use the 'file content' type for the variable.
      ********************
      Tracey
      SellerDeck

      Comment


        #4
        Hi Tracey.

        Thats how I want to use it as a click here to download this variable... only thing is, is that you browse your local machine for the file and then that is what is uploaded to the website, i.e. "c:\temp\thisbrochure.pdf" rather than the actual file being uploaded and then the link going to that.

        What, I suppose, i need answered is should the filename variables upload the file that you have selected and if not, what use is having a filename variable other than for includes?

        Thanks,
        Paul.

        Comment


          #5
          This seems like a bug. If you use a filename variable in an <img src="<actinic:variable name="FileNameTest" />"> tag it gets parsed correctly (only the basic filename gets used). If you use it in an <a href="<actinic:variable name="FileNameTest" />">Click me</a> then the full pathname is passed through.

          The following bit of code will fix this.
          Code:
          			<actinic:block php="true">
          			$pdfname = '<actinic:variable name="FileNameTest" />';
          			if ( $pdfname != '' )
          				{
          				if ( '<Actinic:Variable Name="IsPreviewMode"/>' != TRUE )
          					{
          					$pdfname = preg_replace('/.*\\\\/', '', $pdfname);
          					}
           				echo "<a href=\"$pdfname\" target=\"_blank\">PDF HERE</a>";
          				}
          			</actinic:block>
          It works correctly on Previews and also suppresses the link generation if the variable is empty.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            Thanks norman, I am going to go off and try your version.

            incidently, i was about to email you - could you please send me a copy of collapso-4 as I have lost my original. (anything-goes.co.uk (at) paul)

            Thanks,
            Paul.

            Comment


              #7
              Hi,

              This has already been reported as a bug. The problem is because your file is outside of the 'Site1' folder. It will work as long as the file is within the 'Site1' folder (even if it is within a sub-folder).
              ********************
              Tracey
              SellerDeck

              Comment


                #8
                Hi Tracey,

                The files are in a subfolder of site1:

                site1\graphics\attachments\datasheet.txt

                the uploaded link is:

                http://www.madmash.com/acatalog/grap...\datasheet.txt

                thats with the slashes the wrong way around. The link is obviously half wrong, and the file is not uploaded.

                Thanks,
                Paul.

                Comment


                  #9
                  Hi Paul,

                  Sorry but your previous post mentioned - c:\temp\thisbrochure.pdf, which is why I thought it was outside the site1 folder. I'll check this out.
                  ********************
                  Tracey
                  SellerDeck

                  Comment


                    #10
                    Hi,

                    I've tested this out and my previous understanding of the workaround was incorrect. The files have to be in the root of the Site1 folder (not in subfolders). It is putting the 'sub-folder' from the pc into the link online - and obviously this doesn't exist.

                    The link is obviously half wrong, and the file is not uploaded
                    It uploads on a refresh of the site but not an update, which is not great but is a workaround if you can't manually upload the site or don't want to put your files in the root of the Site1 folder.
                    ********************
                    Tracey
                    SellerDeck

                    Comment


                      #11
                      Paul,

                      You might want to edit out your email address from post #6 as this Forum seems to be scanned by spambots.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment

                      Working...
                      X