Jump to content

why wont this upload script work :(


predator12341

Recommended Posts

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);
}
Link to comment
Share on other sites

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>
Link to comment
Share on other sites

$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...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.