Support Forums

Full Version: Help me, I am about to punch a whole in my wall.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Okay I'm trying to use this php upload script. But I keep getting this error. "Sorry, there was a problem uploading your file."

here is my code

upload.html
Code:
<form enctype="multipart/form-data" action="upload.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>

upload.php
Code:
<?php
$target = "home/users/web/b60/moo.tdrunner95com/ideviceforums.net/packages_upload/";
$target = $target . basename( $_files['uploaded']['name']) ;
$ok=1;

//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_files['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_files['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>

PLEASE HELP ME!
I'm really sorry if this doesn't help, but I don't know PHP at all ><

Where is $ok declared? I think the problem you're having is just because it's value is 0.
(02-22-2012, 04:10 PM)Valderino Wrote: [ -> ]I'm really sorry if this doesn't help, but I don't know PHP at all ><

Where is $ok declared? I think the problem you're having is just because it's value is 0.
No its value if 1... Its checking to see if the value is 0.
(02-22-2012, 04:12 PM)iRun Wrote: [ -> ]No its value if 1... Its checking to see if the value is 0.


OH! I totally skipped that line. >< ($ok=1;)

I'm just making wild guesses here, but I guess it's better than nothing... why not try:

declare(ok=1);