Jump to content

Form uploaded file not showing up


PupChow

Recommended Posts

I am having a hard time getting the form upload script to work and I need to once again turned to the gurus for help. Everything seems to be processing, there is a long pause as during the form process as if the file is being uploaded. The problem is when I check the "uploads" folder, the file is simply not there.

I made sure the form has: enctype="multipart/form-data"

I made sure the "uploads" folder has the necessary permission.

The input box is simply: <input name="Picture" type="file">


Is there any thing else that I am missing?


[code]
// ==============
// Configuration
// ==============
$uploaddir = "uploads"; // Where you want the files to upload to - Important: Make sure this folders permissions (CHMOD) is 0777!
// ==============
// Upload Part
// ==============
if(is_uploaded_file($_FILES['Picture']['tmp_name']))
{
move_uploaded_file($_FILES['Picture']['tmp_name'],$uploaddir.'/'.$_FILES['Picture']['name']);
}
print "Your file has been uploaded successfully! Yay!<br />";
[/code]
Link to comment
Share on other sites

Just a little bit more info, I tried the upload code at PHP manual and got the following result:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Possible file upload attack!
Here is some more debugging info:Array
(
[Picture] => Array
(
[name] => DrJohnson_Panda5.gif
[type] => image/gif
[tmp_name] => C:\PHP\uploadtemp\phpCD9D.tmp
[error] => 0
[size] => 25752
)

)

Entry successfully added.
[/quote]

The code is as followed:
[code]
$uploaddir = '/c:/hosting/webhost4life/member/mychow/uploads/';   //  I tried both /c: and c: //
$uploadfile = $uploaddir . basename($_FILES['Picture']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['Picture']['tmp_name'], $uploadfile)) {
   echo "File is valid, and was successfully uploaded.\n";
} else {
   echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.