By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,281 Members | 523 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,281 IT Pros & Developers. It's quick & easy.

file uploading problem

P: 16
hi all,

I have written a php coding for uploading a file to a specific folder or location in
server which is a Linux server. I think the coding for file uploaing is correct.
But it does not work properly. That means the file is not uploaded to the specified location. It always executes the "else" condition in my coding.
I think the problem is lieing in the specifed path which is the target path for file uploading. I could not find out the solution for that. Please any body help me...

I attached the coding below.......
<form action="<? echo $PHP_SELF; ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="20000" />
Names file: <input type="file" name="myfile">
<input type="submit" name="upload" value="UploadFile" class="butt">

$path = '/var/www/uploads/';
$path .= $_FILES['myfile']['name'];
echo "Successfully uploaded";
echo "Uploading Error";
In this coding it always executes "Uploading Error".....

Any body help me....
I will greatfull for you.........thanks....
Oct 11 '07 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 296

have you looked at Here you will find examples of how to cope with the $_FILE.

Start here, I know it's not that difficult.

Oct 17 '07 #2

Expert 5K+
P: 6,050

Is that supposed to be a comma? - in the if statement..?
Expand|Select|Wrap|Line Numbers
  1. if(move_uploaded_file($_FILES['myfile']['tmp_name'],$path))
  2.                                                  //^ comma?
I'm thinking it should be a fullstop :)
Oct 18 '07 #3

Expert 2.5K+
P: 4,258
ganesanji: Next time enclose any code within the proper code tags.

See the Posting Guidelines on how to do that.

Oct 18 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.