...

View Full Version : Upload File PHP



Erindesign
03-22-2007, 10:35 PM
Hey all,

I have a php script that uploads songs to a directory and then I move them from there once I verify that they are the correct songs.

I have said Please have the song in Artist-SongName name mode, but about 50% of the idiots don't follow this so they just upload the song. Now, That's fine, I guess. I probably wouldn't take my time either since there's no real benefit.

I was wondering if I can do something to the php upload script that renames the file to:

$artist-$filename.ext (assuming $filename.ext is the file)

goughy000
03-22-2007, 10:44 PM
do people fill out what the song name and artist is in the form with the upload?

Erindesign
03-22-2007, 11:10 PM
No sir.

The upload file is within the artist page, which means that the artist is pre-defined in the page already (via mysql query).

I have all the variables, I just dont know how to re-name the file to what I want it.

goughy000
03-22-2007, 11:14 PM
<?php
rename($filename, $artist."-".$filename);
?>

Erindesign
03-22-2007, 11:34 PM
<?php
rename($filename, $artist."-".$filename);
?>


Do I need to set a new variable with this function, or does it just do it and I'm good to go?

Inigoesdr
03-23-2007, 04:03 AM
You should check the filename before you move it and correct it in move_uploaded_file();



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum