Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

[IMG] Upload script doesn't work

Links for php scripts

Moderators: macek, egami, gesf

Postby Redcircle » Thu Feb 12, 2004 4:30 pm

It's an old script and it probably doesn't run becasue of register globals being turned off or becasue of permissions problems.
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby gesf » Sun Feb 22, 2004 4:50 am

Redcircle may be right about the register globals!
For the 'Unlink failed' error, try to check the directory permission!

Or try this code:
Code: Select all
<form action="upload.php" method="post" ENCTYPE="multipart/form-data">
upload file:
<input type='file' size='40' name='imagefile' maxlength='255'>
<input type='hidden' name='MAX_FILE_SIZE' value='500000'>
<input type="submit" value="upload">
</form>


[php]<?
// Replace 'x' with the complete path to where you want upload!
$uploaddir = "x";

if(($HTTP_POST_FILES['imagefile']['type'] == "image/gif")){
$file_realname = trim($HTTP_POST_FILES['imagefile']['name']);
move_uploaded_file($HTTP_POST_FILES['imagefile']['tmp_name'], $uploaddir . $file_realname) or die ("Could not copy the file");
echo "File uploaded succesfuly!"; }

else{
echo "Wrong Filetype ".$HTTP_POST_FILES['imagefile']['name']";
}
?>[/php]
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden


Return to PHP Scripts

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron