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">
Did you know?Explore Trending and Topic pages for more stories like this.
<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

Ariba 9r - SAP MM Integration
Hi experts,

The standard Ariba adapter for 9r creates a relationship between Cost Centers

Big Problem!! Please help
Hi Guys,

Im making a website for a friend have encountered a really annoying problem. When ev

Save username into DB
OkaY so I got my blog to actually save the posts and whatever, all I need now is for it to keep the

extract content from a website
i have written a code that will grab the content from the index page..
i would like to know how c

can i optmize image to 50% quality before uploading 2 server
Hi there

i have jus written a php program to upload and display images but when i try to uplo

Javascript form submit and radio buttons?
When this form is submitted, it is automatically resubmitted using JS.

All my fields are carr

Forgot password won't work
My forgot password thing is not working properly. It is giving me this errorMailbox unavailable. The

Uploading Filetypes and placing them in seperate folders.
Hello,

first post , and asking for help im afraid. Very new to PHP, was making good progress

How do I know when getBounds Method is ready to be called.
I have an application that changes out stylesheets client side. Once I change stylesheet the browse

Why use OOP?
Can someone explain to me why I should use OOP instead of procedure based code.

Im building a

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