Page 1 of 1

Upload Problems

Posted: Mon Jun 17, 2002 5:10 pm
by Jim
My Code:

Code: Select all

//Image Upload

if (is_uploaded_file($HTTP_POST_FILESї'userfile']ї'tmp_name'])) 
{ 
   copy($HTTP_POST_FILESї'userfile']ї'tmp_name'], "/home/www/aoe2/!scripts/filesubmission/temp/"); 
} 
else 
{ 
   echo "Possible file upload attack. Filename: " . $HTTP_POST_FILESї'userfile']ї'name']; 
   
}
My Error:

Possible file upload attack. Filename:

I can't get any upload scripts to work! Why not?

Here's the page:

http://www.aoe2.com/!scripts/filesubmission/index.php

Posted: Mon Jun 17, 2002 11:56 pm
by chris12295
well i cant tell you why your script isnt working but i know this script does.

Code: Select all

if(isset($userfile)) {

if (!eregi('(.gif|.jpeg|.jpg)', $userfile)) {
$invalidPic = "Sorry, only GIF or JPG files  (with a .gif, .jpeg, or .jpg extention) can be accepted.";
exit;
}
if (ereg('.gif', $userfile)) {
$ext = '.gif';
}
elseif (ereg('.jpg', $userfile)) {
$ext = '.jpg';
}
elseif (ereg('.jpeg', $userfile)) {
$ext = '.jpeg';
}
$userfile_name = $newFileName . $ext;
if (copy ($userfile, "your/path/$userfile_name")) {
$message='hi';
}
}
else {
$message='no';
}
this script will only allow jpg gif and jpeg images to be uploaded. it will place them in your directory. If you need more help email me at chris12295@aol.com. Tell me if i helped :wink:

Posted: Tue Jun 18, 2002 1:44 am
by roninblade
well, judging from the current error on your page
Warning: fopen("/www/aoe2/!scripts/filesubmission/pages/.php", "w") - Permission denied in /home/www/aoe2/!scripts/filesubmission/submit_go.php on line 31

Warning: Supplied argument is not a valid File-Handle resource in /home/www/aoe2/!scripts/filesubmission/submit_go.php on line 32
Possible <span style='color:blue' title='I&#39;m naughty, are you naughty?'>smurf</span>. Filename:
i would guess you haven't set the file permissions on the directory. chmod the directory to 777

Posted: Tue Jun 18, 2002 5:52 am
by Jim
That error came because I left something out in the URL:

http://www.aoe2.com/!scripts/filesubmis ... p?map=none

And the upload script isn't working! There are no errors, but the file doesn't show up in the specified directory :(