|
Posted by burgermeister01@gmail.com on 08/24/07 06:20
On Aug 23, 6:08 pm, Reggie <joelregisfo...@hotmail.com> wrote:
> Hi am trying to create a script for users to upload small size video
> clips of themselves and for it to be able to play on the media player
> ive created on there user a/c.
> So users to upload there video and to see it playing on there user
> page.Now am a beginner to php am really trying to learn the coding but
> it so difficult sometimes, but am still trying just need a bit of help
> or guidance to go in the right direction.
>
> This is my script to upload, it dose upload a file but thats all it
> dose.Please help.
>
> <?php
> $target = "upload/";
> $target = $target . basename( $_FILES['uploaded']['name']) ;
> $ok=1;
>
> //This is our size condition
> $upload_size = $_FILES['uploaded']['size'];
> if ($upload_size > 1000000000000)
> {
> echo "Your file is too large.<br>";
> $ok=0;
>
> }
>
> //This is our limit file type condition
> $upload_type = $_FILES['uploaded']['type'];
> if ($upload_type =="text/php")
> {
> echo "No PHP files<br>";
> $ok=0;
>
> }
>
> //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['uploaded']['name']). " has been uploaded";}
>
> else
> {
> echo "Sorry, there was a problem uploading your file.";}
> }
>
> ?>
What you're describing, on the surface, sounds fairly simple, but as
I'm sure you're learning, to be truly effective requires some fairly
sophisticated programming. With that said, my first question would be
how are your user accounts set up? Right now, your script merely
uploads a file, but it does nothing to associate the file with the
user's account. You either need to set up some sort of database for
storing user data and file associations, or you need a file naming
scheme to identify which files belong to which users. Perhaps you can
use that as some kind of foundation to give us a better idea of what
it is exactly you intend to accomplish.
[Back to original message]
|