Jump to content

trouble uploading


dangeorge6

Recommended Posts

I've reached a brickwall trying to upload a file.  The following function is called to upload an mp3 and insert into the database:

 

function addSongs(){
require('globals.php');
$email = $_SESSION['Email'];
//if file uploaded successfully...
if ($_FILES['Filedata']['name']) {
$uploaddir = '/var/www/uploads/#MYURL#/mp3s';
$profile_id = $_SESSION['profile_id'];
$pathname = basename($_FILES['Filedata']['name']);
$query_addsongs = "INSERT INTO $SQL_MP3_TABLE (profile_id, mp3path)
VALUES ('$profile_id', '$pathname')";
mysql_query($query_addsongs) or die(mysql_error());
move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploaddir . basename($_FILES['Filedata']['name']));
//upload mp3


}

}

 

The correct path name inserts into the database, so I know that it sees $_FILES['Filedata']['name'], it just doesn't move the uploaded file into the /mp3 folder.  I tried changing permissions on the mp3 folder and the folder this script is contained to 777 on my Unix box.  Any ideas?

 

Thanks 

Link to comment
https://forums.phpfreaks.com/topic/38686-trouble-uploading/
Share on other sites

globals is just a bunch of global variables and the mySQL connect.

 

I tried that code and it doesn't work.  So, I know that $_FILES['Filedata']['name'] is the name of the file to upload, it just won't move the file.  I should also add that the uploading takes place in a Flash 8 movie using the FileReference actionscript class.

Link to comment
https://forums.phpfreaks.com/topic/38686-trouble-uploading/#findComment-188156
Share on other sites

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.