Can't upload files using post method

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wompus
Forum Newbie
Posts: 2
Joined: Sat Aug 19, 2006 7:03 pm

Can't upload files using post method

Post by wompus »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I can't seem to upload files at all :S...I feel like i've tried everything. I'm using apache2 and php4 on winxp pro. I do get the error msg when the file is too big, but i get nuttin when it's not. All i get is the text 'blah' which is half of my echo command. Oh yeah, and it's not a permission issue because i can create directories fine. Here's what i got:
Uploadtest.html:
[syntax="html"]<html>
<head>
<title>Process Uploaded File</title>
</head>
<body>
<form enctype="multipart/form-data" action="getfile.php" method="post">
<div align="center">
</div>
<label>
<div align="center">Profile Image
<input name="image" type="file"/>
</div>
</label>
<p>
<label>
<div align="center">
<input type="submit" name="Submit" value="Submit" />
</div>
</label>
</p>
</form>
</body>
</html>

getfile.php:[/syntax]

Code: Select all

<html>
<head>
<title>Process Uploaded File</title>
</head>
<body>
<?php
$file = $_FILES['userFile'] ['tmp_name'];
echo $file;
move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],
"../members/{$_FILES['uploadFile'] ['name']}")

?>
</body>
</html>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]3.[/b] Do not make multiple, identical posts. This is viewed as spam and will be deleted.[/quote]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Your file field is named "image" while your script looks for "userFile."
wompus
Forum Newbie
Posts: 2
Joined: Sat Aug 19, 2006 7:03 pm

embarassing

Post by wompus »

You know what's embarassing? The fact that i spent the last 6 hrs trying to figure it out rofl

I need to sleep.
*shakes head*
Post Reply