Jump to content

Autofill with information from $_FILES


tail

Recommended Posts

I'm trying to create a script to add music to a database. Currently I'm using ID3tag to get the ID3 information from the MP3. The way I have the form set up is like this:

Screenshot-2.png

When Auto-Fill is clicked, the script detects it and the ID3 information is echoed to the form, like this:

Screenshot-3.png

However, the file is obviously no longer in the input. I tried to overcome this by making a hidden form field with a value of $_FILES['file']['tmp_name'] but it didn't work.

 

I don't know AJAX or how it works, but it seems that perhaps it would be possible to send the $_FILES['file']['tmp'] variable to an external script that gets the ID3 information from the ID3 class, and then returns the values to the form. Yes? No? Please help.

Link to comment
Share on other sites

I'm using code from this project: getID3

 

Here is the code:

require_once('/var/www/getid3/getid3.php');
$getid3 = new getID3;
$file=$_FILES['file']['tmp_name'];
$id3 = $getid3->analyze($file);
getid3_lib::CopyTagsToComments($id3);
$cbr=($id3['audio']['bitrate_mode'] == 'cbr') ? ' CBR' : '';
$id3['audio']['bitrate']=round($id3['audio']['bitrate']/1000).'kbps'.$cbr;
$length=explode(':',$id3['playtime_string']);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.