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

file_put_contents and createimagefromjpeg
All,
I do somethings and then I have the following code:
file_put_contents('./test/'.$filename

a very simple php header question (sorry!)
Firstly...I do apologise if this annoys anyone....a header error

I'm do not know php &

2 decima places & How to reload my page
Hello There,

How do i put full-stop (.) after second figure from behind? ie if i have 123456

Taking an HTML form and a PHP program and making it into one working file.
Hello,

So I would like to display everything INSIDE a specific directory. In other words, I

how make 2 column in table with data tybe long row
hi every one

I want make in my table 2 column with data tybe long raw

how thi

Small problem with image resize script
Hi!

I am a little bit new to php and I have an issue installing an image resize script I down

Loops and Classes
I am making a template system and everything seems to be going well up until I have to loop in a var

Drop Down and text box issue
Is it possible to set a drop down list and text boxes to a certain width?

here is my code

Extracting Long text from message class with parameters
Hi,

I would like to extract the long text from a message class. However, the long text ha

Error in write byte array into document in SM58
Hi Gurus,

Getting the following error status in Transactional RFC (SM58) ..... *Error i

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