 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Hyaxor Master Cheater
Reputation: 0
Joined: 25 Jan 2009 Posts: 251
|
Posted: Sun Feb 07, 2010 8:37 am Post subject: Anyone good at PHP? |
|
|
Well, I'm trying to make a small file uploading website called BeanLoad(max. file upload is 10MB) and I can't seem to get it right.
I got an HTML file called upload.html with this code in it:
| 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="Beanload" />
</form> |
And a PHP file called upload.php with this code in it:
| Code: | <?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if ($uploaded_size > 10000000)
{
echo "Your bean is too large, maximum upload range is 10MB.<br>";
$ok=0;
}
if ($uploaded_type =="text/php")
{
echo "PHP files aren't allowed.<br>";
$ok=0;
}
if ($ok==0)
{
Echo "Sorry, your bean was not uploaded";
}
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "Your bean ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your bean.";
}
}
?> |
And i've got a folder called files. All that on a domain.
The problem is, when I select a file and try to upload it, it just gives me an error message(on 000webhost at least). You can find a preview on http://www.beanload.webatu.com/upload.html
EDIT: Nvm, got it working.
|
|
| Back to top |
|
 |
Roy Advanced Cheater
Reputation: 0
Joined: 01 Aug 2009 Posts: 60
|
Posted: Sun Feb 07, 2010 3:20 pm Post subject: Re: Anyone good at PHP? |
|
|
| Hyaxor wrote: | Well, I'm trying to make a small file uploading website called BeanLoad(max. file upload is 10MB) and I can't seem to get it right.
I got an HTML file called upload.html with this code in it:
| 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="Beanload" />
</form> |
And a PHP file called upload.php with this code in it:
| Code: | <?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if ($uploaded_size > 10000000)
{
echo "Your bean is too large, maximum upload range is 10MB.<br>";
$ok=0;
}
if ($uploaded_type =="text/php")
{
echo "PHP files aren't allowed.<br>";
$ok=0;
}
if ($ok==0)
{
Echo "Sorry, your bean was not uploaded";
}
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "Your bean ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your bean.";
}
}
?> |
And i've got a folder called files. All that on a domain.
The problem is, when I select a file and try to upload it, it just gives me an error message(on 000webhost at least). You can find a preview on http://www.beanload.webatu.com/upload.html
EDIT: Nvm, got it working. | That's pretty lame code you know, you could have shortened it a lot.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|