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

duplicate record notification
In my database, after insertion of records, I want to know if the record inserted is duplicate or no

Problem with PHP code- simple contact form
I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a contact form wit

filesize problem
i use ubuntu 9.10 and i have mountet a folder from an windows

/mount/FOLDER
/mount/FOLDER/

Creating XML with php
I need to creat an XML with php and have successfully produced a valid output.
The problem I hav

Code error with Index.php
Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/runevid/public_

need a script for 3 pages
I have a customer who wants me to set up a site with a number of pages with the following requiremen

Echoing If Function?
A script I am using has If statements in the comments form to basically tell the form what to do. Cu

Curly Bracket Delimeters.
I'd always believed that the starting and ending delimeters in preg_ functions had to be the same ch

Pulling out some result data from MYSQL
Hey Guys,

I've built a PHP page that has a for just imagine something like registration form

Material Issuing for receiving batch
Dear All experts in MM/ PP,

Material issuing from main stores to factory is currently usi

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