Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-01-2006, 04:28 PM   PM User | #1
jaywhy13
Regular Coder

 
Join Date: Dec 2004
Location: Jamaica
Posts: 592
Thanks: 2
Thanked 0 Times in 0 Posts
jaywhy13 is an unknown quantity at this point
Upload Error 1

$uploaddir = '/home/jay/miguel/music/';
$uploadfile = $uploaddir . basename($_FILES['mediaFile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
echo '<pre>';
print_r ($_FILES);
echo '</pre>';
}

Gets me the error
Possible file upload attack!

Array
(
[mediaFile] => Array
(
[name] => all 4 one - i can love you like that.mp3
[type] =>
[tmp_name] =>
[error] => 1
[size] => 0
)

)

Funny that code looks real simple... I have write permissions to the directory. What's wrong?
__________________
I'm gonna find a way to download the internet if its the last thing I do...
Prepare to bow down to me (or my grave) and call me almighty when the algorithm is finished
jaywhy13 is offline   Reply With Quote
Old 09-01-2006, 04:31 PM   PM User | #2
managedinternet
New Coder

 
Join Date: Aug 2006
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
managedinternet is an unknown quantity at this point
look a few threads down for my code

exact same script as you are using

al the best
managedinternet is offline   Reply With Quote
Old 09-01-2006, 04:32 PM   PM User | #3
managedinternet
New Coder

 
Join Date: Aug 2006
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
managedinternet is an unknown quantity at this point
think this might be your problem

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))

a few lines up you have
$_FILES['mediaFile']

use 1 or the other
managedinternet is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:03 AM.


Advertisement
Log in to turn off these ads.