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
https://forums.phpfreaks.com/topic/188132-autofill-with-information-from-_files/
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']);

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.