標題

2012-08-02 36 views
-4

可能重複:
Reading a File's Metadata標題

我有這個形式我在哪裏上傳MP3文件,但我希望用戶上傳的音樂和所有細節,比如作者,標題等mp3的應該會自動填寫在表單field.i我使用PHP,並希望任何PHP/JavaScript的方法,可以從本地機器找出文件的名稱,並將該名稱在我的表格標題字段 我的表格如下。我不希望用戶輸入書名,作者等

<form enctype="multipart/form-data" method="post" action="http://youshare.ca/music/writestorypost"><p><span class="form_label">Name of the song</span><input type="text" value="" name="title" style="width:400px" class="inputText required"></p><p><span class="form_label">Description</span> 
<textarea class="rich" style="width:580px" rows="18" name="form_content"></textarea> 
</p><p><span class="form_label">Tags</span> 
    <input type="text" value="" style="width:300px" name="tags" class="inputText"> 
    <span>Multiple tags should be Separated with commas(,)</span> 
    </p> 
     <p><label>Upload</label><input type="file" name="song"> 
     <span>Only mp3 is accepted</span></p> 
     <p><label>Music source</label> 
     <input type="radio" checked="1" value="own" name="musicsource">My own 
     <input type="radio" value="others" name="musicsource">From another musician 
     </p> 
     <div style="display:none" id="ms_others"> 
     <p><label>Musician name</label><input name="musician"></p> 
     </div> 
     <div id="ms_own"> 
     <p></p> 
     </div> 
     <p><label>Picture (Optional)</label><input type="file" name="picture"> 
     <span>A picture about the song or the musician</span></p> 
     <script type="text/javascript"> 
    jQuery(document).ready(function($) { 
     $("input[value='own']").click(
      function() { 
      $("#ms_others").hide(); 
      $("#ms_own").fadeIn(); 
      } 
      ); 
     $("input[value='others']").click(
      function() { 
      $("#ms_own").hide(); 
      $("#ms_others").fadeIn(); 
      } 
      ); 
    }) 
    </script><p><input type="submit" value="Submit" class="button"></p><input type="hidden" value="935" name="page_id"></form> 
+3

[您嘗試過什麼?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – Palladium 2012-08-02 17:39:12

+0

請減少此處的代碼量,並且只發布對於你在做什麼。 – Matt 2012-08-02 17:39:38

回答

0

您需要填寫你的MP3的詳細信息的文件上傳後,除非他們手工輸入的所有信息。

在PHP端,您可以安裝以下:PHP ID3

有關於如何從文件中讀取ID3標籤的例子在那裏。

+0

我不同意你的看法。您只需上傳YouTube上的任何視頻。當您上傳標題時,系統會自動發送該文件,但該文件剛剛開始上傳 – user1515503 2012-08-03 02:06:22