Page 1 of 1

Mp3 file upload fail

Posted: Thu Jun 02, 2005 11:36 pm
by zactanaz
Ok i have this file upload code, and everything seems to go right, but the file does not get uploaded.

Form:

Code: Select all

echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\" id=\"AutoNumber1\">\n";
			echo "  <tr>\n";
			echo "    <td width=\"100%\">\n";
			echo "    <p align=\"center\">Subir Cancion (Mp3)</td>\n";
			echo "  </tr>\n";
			echo "  <tr>\n";
			echo "    <td width=\"100%\">&nbsp;</td>\n";
			echo "  </tr>\n";
			echo "  <tr>\n";
			echo "    <td width=\"100%\">\n";
			echo "    <p align=\"center\">Seleccione Archivo:</td>\n";
			echo "  </tr>\n";
			echo "  <tr>\n";
			echo "    <td width=\"100%\">\n";
			echo "    <form method=\"POST\" enctype=\"multipart/form-data\" action=\"modules.php?name=$modulename&file=admin\">\n";
			echo "      <p align=\"center\"><input type=\"file\" name=\"mp3\" size=\"40\"><br>\n";
			echo "      <br>\n";
			echo "      <input type=\"submit\" value=\"Subir\"></p>\n";
			echo "      <input type=\"hidden\" name=\"lid\" value=\"$lid\">\n";
			echo "      <input type=\"hidden\" name=\"op\" value=\"mp3upload\">\n";
			echo "    </form>\n";
			echo "    </td>\n";
			echo "  </tr>\n";
			echo "</table>\n";
and for the upload:

Code: Select all

$mp3url_name = $_FILES['mp3']['name'];
        $mp3url_temp = $_FILES['mp3']['tmp_name'];
        $ext = substr($mp3url_name, strrpos($mp3url_name,'.'), 5);
        $new_file_name = "song_$lid$ext";
        if (move_uploaded_file($mp3url_temp, "modules/$modulename/music/$new_file_name")) {
            chmod("modules/$modulename/music/$new_file_name", 0755);
            $mp3url = "modules/$modulename/music/$new_file_name";
        }

I used phpnuke just in case. Thanks.

Posted: Thu Jun 02, 2005 11:48 pm
by hawleyjr
Try using the whole document path:

Code: Select all

modules/$modulename/music/$new_file_name

Code: Select all

/http/myserverpath/modules/$modulename/music/$new_file_name

Posted: Thu Jun 02, 2005 11:58 pm
by zactanaz
ok i tried it.. but still the same..

seem to go fine... no upload

Posted: Thu Jun 02, 2005 11:59 pm
by hawleyjr
What errors are you getting?

Did you do a is_dir() on the directory?

Posted: Fri Jun 03, 2005 1:12 am
by Syranide
MAX_POST_SIZE (or something like that)

cannot post files larger than 4M by default. (only server admin can modify this)