1 Reply Latest reply on Jun 2, 2008 5:11 AM by Günter Schenk

    Dynamic links to files

      Hi,
      i am working on a page which should dynamically link to a pdf file and a window media file.
      I have designed the multiple upload form and the page that displays all the records in the database.
      The issue is how do i link particular pdf/video to corresponding files so that on click pdf it opens the pdf file and on click the window media it opens a browser that displays the corresponding video file.
      Trusting you for a solution.
      Regards
      Yomi
        • 1. Re: Dynamic links to files
          Günter Schenk Level 4
          Hi Yomi,

          you´ll need to have PHP extract the file suffix (usually a period followed by 3 chars, like .pdf or .wmv) from the recordset value which represents the "file" column, and establish a PHP if/else condition which returns different links depending on the result -- the PHP function "substr" (http://de2.php.net/substr) will be of great help, example:

          if (substr(strtolower($row_rsqueryname['column_name']), -4) == ".pdf") {
          display link to the PDF file
          }
          else if (substr(strtolower($row_rsqueryname['column_name']), -4) == ".wmv") {
          display link to a popup window playing the wmv file
          }

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver