PHP File Upload Problem


Posted on 16th Feb 2014 07:03 pm by admin

Hi, I have written a very simple file upload script but it fails for reasons I can't explain. Hopefully someone here can help me out. I have checked php.ini and file uploads are on with a limit of 10M. Here's the code:

The Form
Code: <form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
And the PHP
Code: $target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{echo "File has been uploaded";}
else
{echo "The upload did not work.";}
Any help is appreciated. Assuming the target path should be [dir where the form and php are]/uploads - this exists and is 777'd.

Thank you

No comments posted yet

Your Answer:

Login to answer
92 Like 6 Dislike
Previous forums Next forums
Other forums

SCRIPT ERROR
Here is the CONTACT FORM I made for our website:

<form id="form1" name="

Facebook status update API
Hello,

So, I'm trying to create my first Facebook application with PHP.

Basic ideas fo

How to Handle more than one submit button in single form?
Hi
I have one PHP file which contains one Form. In this form there are two Submit type Buttons

try catch error
I have been trying try catch but, I can't get it to work. The code opens a non existing file called

generating all possible random letters
hi'

how can i randomize the letters a,b,c,d,e all possible ways, and i want to print the res

am I using this for loop correctly
Dear buddies!

Right now I am generating a report with some details for all the dealers.

How to read CSS message data
Hi,
I have a requirement here. When working as a Dev angel for multiple customers its really di

Email Form Syantax Issue 2
How to make this look FROM:"OUR TEAM" instead of FROM:abc@mail.com

$headers = "

Escape Latin Characters
I need to escape latin characters in an xml doc. Example: "é" is escaped to "é". I thoug

update the selected existing records of database
Hi frndz,
I am new to php and get stuck....

Edit.php > Update.php > Updatea

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash