Connecting Tech Pros Worldwide Help | Site Map

upload script

  #1  
Old August 24th, 2007, 12:15 AM
Reggie
Guest
 
Posts: n/a
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.";
}
}
?>

  #2  
Old August 24th, 2007, 01:35 AM
Jerry Stuckle
Guest
 
Posts: n/a

re: upload script


Reggie wrote:
Quote:
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.";
}
}
?>
>
So, what kind of problem are you having?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  #3  
Old August 24th, 2007, 07:25 AM
burgermeister01@gmail.com
Guest
 
Posts: n/a

re: upload script


On Aug 23, 6:08 pm, Reggie <joelregisfo...@hotmail.comwrote:
Quote:
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.

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with upload script and CHMOD's petershaman answers 5 November 16th, 2008 06:18 PM
Pure ASP Upload - script unable to redirect for larger files ll answers 0 August 18th, 2008 11:15 PM
Php Upload script not working camphor answers 5 May 28th, 2008 07:52 PM
Newbie Upload Script Help grozanc answers 2 May 20th, 2007 10:31 AM
Upload script error brian.digipimp@gmail.com answers 4 December 1st, 2005 09:25 AM