It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

PHP file uploader not working?

Moderator: Malcolm

PHP file uploader not working?

Postby johnyct9760 on Wed Sep 10, 2008 6:53 pm

Hello and thx for reading my post. I can't get this PHP uploader to work

I followed the tutorial as closely as I could and something went wrong, here is a link to the test page:

http://www.johncliffordtaylor.com/upload2/

Every time I upload it say that the file didn't upload.

Here is a link to the tutorial I was following:

http://www.tizag.com/phpT/fileupload.php

And here is the PHP code that I ended up with I've looked it over for mistakes:

Code: Select all
<?php
$target_path = "/johncliffordtaylor.com/upload2/uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_FILES['uploadedfile']['tmp_name'];

$target_path = "/johncliffordtaylor.com/upload2/uploads/";
$target_path = $target_path . basename($_FILES['uploadedfile']['name']);

if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target_path))
{
echo "The File". basename($_FILES['uploadedfile']['name']).
"has been uploaded";
}
else
{
echo "There was an error uploading your file please try again. And remember that all uploaded files need to be under 50 megs.";
}
?>


Any help would be greatly appreciated
User avatar
johnyct9760
 
Posts: 22
Joined: Sun Mar 02, 2008 5:21 am
Location: USA, Michigan

Postby npsari on Thu Oct 09, 2008 11:37 pm

Why not get a different upload script from somewhere else
There are many different one on the web i would say
Just search for 'Image upload, php'
npsari
 
Posts: 19
Joined: Thu Mar 08, 2007 7:14 pm
Location: England

Postby rangana on Fri Oct 10, 2008 12:09 am

This is double declaration, which means that only the later will work. Remove either of the two.
Code: Select all
$target_path = "/johncliffordtaylor.com/upload2/uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_FILES['uploadedfile']['tmp_name'];

$target_path = "/johncliffordtaylor.com/upload2/uploads/";
$target_path = $target_path . basename($_FILES['uploadedfile']['name']);


Another err is your move uploaded file syntax. Change it to uploadedfile instead of uploaded.
Code: Select all
$_FILES['uploaded']['tmp_name']


Hope that makes sense.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 0 guests