2012-02-16 15 views
1

這就是我所做的。我修改了我們教會正在使用的SermonSpeaker模塊上傳的前端,以便我們可以連接S3亞馬遜雲存儲我們的講道mp3。原始的前端形式是2部分。第一部分是上傳mp3音頻,最初鏈接到表單的第二部分,您可以在其中添加講道標題,經文等等。它會在表單的第二部分顯示文件的名稱,一旦完成,將正式發佈佈道,並在佈道音頻鏈接中正確路由路徑。我使用了S3亞馬遜郵件的教程,它的功能就像一個魅力,我已經能夠成功地將表單的第1部分重定向到第2部分,但文件名顯示爲「。$ filename」,並且直接鏈接顯示在Joomla後端彈起「/hcpp/cpcpca-sermons.s3.amazonaws.com//'.$filename」PHP/HTML鏈接第2步調用第1步中上傳的文件名

我也希望它拒絕任何非MP3文件類型。我使用的base64策略的條件特徵似乎不起作用,因爲我上傳了pdf文件作爲測試,並且他們已經經歷了而不是被拒絕。我仍然是這些東西中的小菜鳥,但我感覺如此接近突破,下面是我一直在處理的文件的副本

這是我用來調用重定向到第2步的部分:

<?php 
defined('_JEXEC') or die('Restricted access'); 
?> 
<table border="0"> 
    <tr> 
     <td width ="50"></td> 
     <td><h1><?php echo JText::_('COM_SERMONSPEAKER_FU_NEWSERMON'); ?></h1></td> 
    </tr> 
    <tr> 
     <td width ="50"></td> 
     <td><b><?php echo JText::_('COM_SERMONSPEAKER_FU_STEP'); ?> 1 : </b><?php echo JText::_('COM_SERMONSPEAKER_FU_STEP1'); ?></td> 
    </tr> 
    <tr> 
     <td colspan ="4">&#160;</td> 
    </tr> 
    <tr> 
     <td width ="50"></td> 
     <td align='left'> 

<form action="http://s3.amazonaws.com/cpcpca-sermons" method="post" enctype="multipart/form-data"> 
<input type="hidden" name="key" value="${filename}" /> 
<input type="hidden" name="acl" value="public-read" /> 
<input type="hidden" name="content-type" value="audio/mp3" /> 
<input type="hidden" name="redirect" value="http://www.cpcpca.org/index.php?option=com_sermonspeaker&view=fu_step_2&filename='.$filename" /> 
<input type="hidden" name="AWSAccessKeyId" value="REMOVED" /> 
<input type="hidden" name="policy" value="REMOVED"/> 
<input type="hidden" name="signature" value="REMOVED" /> 

     <!-- Include any additional input fields here --> 

     File to upload: 
     <input name="file" type="file"> 
     <br> 
     <input type="submit" value="Upload Sermon"> 
    Please upload mp3's only. 
    </form> 
      <br/>&nbsp;<br/> 
     <td> 
    </tr> 
    <tr> 
     <td width ="50"></td> 
     <td><?php echo SermonspeakerHelperSermonspeaker::fu_logoffbtn(); ?></td> 
    </tr> 

</table> 

回答

1

您必須將php變量放在php標記中:將它們視爲php代碼,否則視爲html。同樣在url中,你必須回顯變量http://www.cpcpca.org/index.php?option=com_sermonspeaker&view=fu_step_2&filename=<?php echo $filename ?>

+0

我收到錯誤,例如「無效的策略:無效的JSON」。我在哪裏放行結束引號。我必須在政策中以同樣的方式反映出來。這就是我添加的內容:' />'我故意使用httx而不是http,因爲格式問題有限 – radiodavefm 2012-02-16 20:24:44

+0

我會這樣做(不需要標籤):'」/>' – robertboloc 2012-02-16 20:46:57

+0

儘管它適用於php文件,但我在使用它時遇到問題在S3 Amazon策略中添加重定向行:{「redirect」:「httx://www.cpcpca.org/index.php?option = com_sermonspeaker&view = fu_step_2&filename =」<?php echo $ filename?> 「},產生一個錯誤:無效的策略:無效的JSON。 – radiodavefm 2012-02-16 21:20:05