Page 1 of 1
Upload File (Song)
Posted: Wed Dec 13, 2006 9:27 pm
by dclamp
Hello. I am having trouble with my upload code. It keeps returing a php chmod error "File Does Not Exist"
here is my code:
Code: Select all
// upload
$org_file_name=$_FILE["mp3file"]["name"];
$temp_file_name=$_FILE["mp3file"]["tmp_name"];
$file_name = $member_id . "-" . $org_file_name;
$song_url = "songs/" . $file_name;
$result = move_uploaded_file($temp_file_name, $song_url);
$res = chmod($song_url, 0755);
Posted: Wed Dec 13, 2006 9:40 pm
by feyd
Have you verified that the file it is referencing does exist?
Posted: Wed Dec 13, 2006 9:45 pm
by dclamp
yes. and it does not exist. Forgot to include this in the first post.
Posted: Thu Dec 14, 2006 3:34 am
by volka
You should not only store the result of move_uploaded_file but check it for true or false.
try
Code: Select all
error_reporting(E_ALL); ini_set('display_errors', true);
$org_file_name=$_FILE["mp3file"]["name"];
$temp_file_name=$_FILE["mp3file"]["tmp_name"];
$file_name = $member_id . "-" . $org_file_name;
$song_url = "songs/" . $file_name;
$result = move_uploaded_file($temp_file_name, $song_url);
if ( false===$result ) {
die("failed to move uploaded file to '$song_url'");
}
$res = chmod($song_url, 0755);
Posted: Thu Dec 14, 2006 10:25 pm
by dclamp
ok. with the code that you gave me, i am getting these errors:
Code: Select all
Notice: Undefined variable: _FILE in /home/jphendr/public_html/beta/edit_mprofile1.php on line 225
Notice: Undefined variable: _FILE in /home/jphendr/public_html/beta/edit_mprofile1.php on line 226
failed to move uploaded file to 'songs/4-'
Posted: Thu Dec 14, 2006 11:25 pm
by Kieran Huggins
the superglobal you're trying to use is $_FILES <-- notice the "S" on the end, as it's plural.
Cheers,
Kieran
Posted: Fri Dec 15, 2006 7:15 pm
by dclamp
ok. now i am getting this error:
Code: Select all
failed to move uploaded file to 'songs/5109-I Touch Myself.mp3'
Posted: Fri Dec 15, 2006 8:12 pm
by John Cartwright
is songs/ directory accessible and have permissions?
Posted: Fri Dec 15, 2006 8:53 pm
by dclamp
Jcart wrote:is songs/ directory accessible and have permissions?
it is 777.
Posted: Fri Dec 15, 2006 9:25 pm
by Kieran Huggins
Just a wild stab in the dark here, but is the songs directory directly beneath where the script is executing from?
Also try the same path with a preceding
./ - just to be safe.
If it's still broken, check:
- is the disk full?
have you exeeded your disk qouta?
are you exceeding your max_execution_time?
are you exceeding your post_max_size?
do you have divinyls_uploads enabled?
Then I'd start debugging by putting a few files in that directory manually and trying to list the directory from within the script.
Cheers,
Kieran