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

Placing and array within an array then sorting it!
I have a page that runs two large mysql queries and saves the results into arrays, in php I then per

Simultaneous select/update/insert
Hi

How would I need to go about when 2 users update a single row simultaneous? And how would

sapgui f4 help last search
I know this has to be simople. One user (maybe more) does not have the "last search saved" from the

using a loop help
Hi guys , i need some help. I have this loop :
while ($row = mysql_fetch_assoc($Result)) { ?&

ALV sum various columns problem
Hi all,
I'm doing a report on ABAP for a timesheet of the current month. The output i want is s

setcookie and isset($_COOKIE(name)) seem very finnicky.
I'm currently playing around with a user system with login and registration. I'm trying to use cooki

Greek characters in php
Hi,

I'm making a script and I m using for first time greek characters.
I started to write

IP question
ive got 2 ip addresses both global from same user how would i detect if they are local to each other

Giving the below syntax error
Dear Experts,

I have used 2 buttons in gui status as display and cjhange.When the user wi

How to separate records and ORDER BY
Let say i have 100 records and displayed in one page, then i want to get the records from 50-100 and

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