PDA

View Full Version : Need Upload Script



CANNIBALEX
10-05-2009, 01:58 PM
For file upload websites. Preferably in flash.

I've tried everything I can get my hands on and nothing will work.


Any links appreciated!

jackass
10-05-2009, 02:02 PM
A 'thanks' or a 'please' would be nice, but hey!

Here's a simple php one...


<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;

if ($uploaded_size > 350000)
{
echo "Your file is too large.<br>";
$ok=0;
}

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

if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

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.";
}
}
?>

CANNIBALEX
10-05-2009, 02:59 PM
Thanks and appreciation are pretty much the same thing.

But thanks as well!

CANNIBALEX
10-05-2009, 03:05 PM
Also,

Is this the script to embed the upload, or the server php script?

And is the upload limit in Bytes or Kbs?

Edited by Xarea (Forum Moderator): Please do not double post - thanks :).

Protege
10-05-2009, 03:15 PM
In bytes. Its the processing part which will allow anyone to upload anything to your site.

Could be a bit neater, but I guess it does the job.

CANNIBALEX
10-05-2009, 03:19 PM
And how safe is this?

If i disallow .exe files for upload will it be fine?
Can i use this script with a flash uploader embedded into the site?

Thanks

Protege
10-05-2009, 03:28 PM
Yeah of course you will be fine, nothing can be more dangerous than a .exe file on your server!

If you want a flash uploader, you've got to see what class it uses to upload, say filereference like mine does, the data you'd grab be $_FILES[ 'filedata' ].

CANNIBALEX
10-05-2009, 03:47 PM
Wheres the best place to find a basic flash uploader? The one'es i found came out on my site as a giant blue square

Want to hide these adverts? Register an account for free!