Jump to content


Photo

why wont this upload script work :(


  • Please log in to reply
7 replies to this topic

#1 predator12341

predator12341
  • Members
  • PipPipPip
  • Advanced Member
  • 87 posts
  • LocationCheshunt, Hertfordshire, England

Posted 26 July 2006 - 01:00 PM

Hi all the below code works fine in another project but not the one i am doing currently.

the folders have chmod of 777 so no write issues UPLOAD_PATH is set to the right upload path but i just cant think y it aint working everything looks fine.
please help
regards
Mark

sorry forgot to say it looks as if it is not getting the value inside the file input box i pass it yet it knows it is there as if i use the empty function it sees that there is something in there but when i need to use it in the below code it dont work :(

Code Below

$fileName = $_FILES['uploaded']['name'];
$target = UPLOAD_PATH;
$target = $target .'/'. $_FILES['uploaded']['name'];
echo $target;
$ok=1;

if ($fileName =="text/php")
{
echo "No PHP files<br>";
$ok="0";
}

if($ok == "0")
{
echo "Sorry, there was a problem uploading your file.";
}
else
{
move_uploaded_file($_FILES['uploaded']['tmp_name'], $target);
}
[a href="http://www.sloganizer.net/en/" target="_blank"][/a]

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 July 2006 - 01:16 PM

wheres the form
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 predator12341

predator12341
  • Members
  • PipPipPip
  • Advanced Member
  • 87 posts
  • LocationCheshunt, Hertfordshire, England

Posted 26 July 2006 - 01:29 PM

here :)
<form method="POST" action="pdfUploader.php">
*** code here that dont get transfered***

<input type="file" name="uploaded" />

*** code here that dont get transfered***

<input type="submit" name="upload" value="upload" />

*** code here that dont get transfered***

</form>
[a href="http://www.sloganizer.net/en/" target="_blank"][/a]

#4 ozPATT

ozPATT
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 26 July 2006 - 01:42 PM

$fileName = $_FILES['uploaded']['name'];

if ($fileName =="text/php")

aren't you setting the filename to be the actual name of the file? not the file type? not sure if that has anything to do with anything, but just an observation...

#5 predator12341

predator12341
  • Members
  • PipPipPip
  • Advanced Member
  • 87 posts
  • LocationCheshunt, Hertfordshire, England

Posted 26 July 2006 - 01:52 PM

that line checks to see it it is file type of .php that is not setting anything == means check not make
[a href="http://www.sloganizer.net/en/" target="_blank"][/a]

#6 predator12341

predator12341
  • Members
  • PipPipPip
  • Advanced Member
  • 87 posts
  • LocationCheshunt, Hertfordshire, England

Posted 26 July 2006 - 02:55 PM

anyone got any thoughts?
[a href="http://www.sloganizer.net/en/" target="_blank"][/a]

#7 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 26 July 2006 - 02:58 PM

You need to include enctype="multipart/form-data" in your <form> tag.

Ken

#8 predator12341

predator12341
  • Members
  • PipPipPip
  • Advanced Member
  • 87 posts
  • LocationCheshunt, Hertfordshire, England

Posted 26 July 2006 - 03:24 PM

my bad it is now fixed thanks for that ken
[a href="http://www.sloganizer.net/en/" target="_blank"][/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users