Jump to content

elementz

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Posts posted by elementz

  1. Anyone know a tutorial or script that makes a unique link download that can be limited to x downloads. I am going to intergrate it with IPN so I can make my own download manager and save money. If you have any suggestions or help, please post it.

    Thankyou,
    Luke
  2. Here are the files:

    [b]index.html[/b]
    [code]<html>
    <head>
    <title>Worlds Hosting Image Uploader</title>
    </head>

    <body>
    <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
    <form action="upload.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
    <td>
    <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
    <tr>
    <td><strong>Image Upload</strong></td>
    </tr>
    <tr>
    <td>Select Image
    <input name="ufile" type="file" id="ufile" size="50" /></td>
    </tr>
    <tr>
    <td align="center"><input type="submit" name="Submit" value="Upload" /></td>
    </tr>
    </table>
    </td>
    </form>
    </tr>
    </table>
    </body>
    </html>[/code]


    [b]upload.php[/b]
    [code]<html>
    <head>
    <title>Worlds Hosting Image Uploader</title>
    </head>
    <body>

    <?php

    $valid = array (".png",".jpg",".gif",".bmp");


    $filename = $HTTP_POST_FILES['ufile']['name'];

    $type = strtolower(strstr($filename, '.'));
    if (!in_array($type, $valid)) {
    echo ("The submitted file was of invalid type.<br />");
    }


    $random_digit=rand(00000000,99999999);



    $new_file_name=$random_digit.$filename;


    $path= "upload/".$new_file_name;
    if($ufile !=none)
    {
    if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
    {
    echo "Successful<BR/>";

    $homeurl='http://www.worlds-hosting.com/image/upload/'

    $url=$homeurl.$new_file_name;

    }
    else
    {
    echo "Error";
    }
    }
    ?>

    <img src="<? echo $url; ?>"><br><br>
    <a href="<? echo $url; ?>"><? echo $url; ?></a><br>
    <?php
    echo "File Size: ".$HTTP_POST_FILES['ufile']['size']."<BR />";
    echo "File Type: ".$HTTP_POST_FILES['ufile']['type']."<BR/>";
    ?>


    </body>
    </html>[/code]


    But when I try to run it, it gets the following error:

    [b]Parse error: parse error, unexpected T_VARIABLE in /home/worldsh/public_html/image/upload.php on line 36[/b]


    Please help fix it.


    Thankyou,
    Luke
  3. I meant normal input boxes that you can write in, not upload ones and what will the variables come up as? Also how do I make the submit button an image?

    Thankyou,
    Luke

    I mean as in same variable as if the upload input box wasn't there.
  4. [!--quoteo(post=360311:date=Mar 31 2006, 09:22 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 31 2006, 09:22 PM) [snapback]360311[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Are you using a database? If you do can you show us the code use for:
    - connecting to database server
    - selecting database, and
    - when you query the database.
    [/quote]

    Nope, I am just testing the uploading script. Thats why I have commented out the user system. Could it be to do with the server?

    Thankyou,
    Luke
  5. [!--quoteo(post=360267:date=Mar 31 2006, 04:34 PM:name=elementz)--][div class=\'quotetop\']QUOTE(elementz @ Mar 31 2006, 04:34 PM) [snapback]360267[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    [code]<?
    //ob_start();
    //the above line needs to be above ALL HTML and PHP (except for <?).
    //include("config.php");
    //gets the config page, which connects to the database and gets the user's information
    //if ($logged[username])
    //{
    //checks to see if they are logged in
    switch($_GET[song])
    {
    //this allows us to use one page for the entire thing
    default:
    break;

    case 'upload':
    echo ("<form action=\"song.php?song=add\" enctype=\"multipart/form-data\" method=\"post\"><br />
    Select file
    <input name=\"ufile\" type=\"file\" size=\"50\">
    <input type=\"submit\" name=\"Upload\" value=\"Upload\">
    </form>");

    break;

    case 'add':
    $valid = array (".mp3",".wma");

    $type = strtolower(strstr($filename, '.'));
    if (!in_array($type, $valid)) {
    echo ("The submitted file was of invalid type.<br />");
    }

    $file_name = $HTTP_POST_FILES['ufile']['name'];
    $random_digit=rand(00000000,99999999);
    $new_file_name=$file_name.$random_digit;

    //set where you want to store files
    //in this example we keep file in folder upload
    //$new_file_name = new upload file name
    //for example upload file name cartoon.gif . $path will be upload/cartoon.gif
    $path= "songs/".$new_file_name;
    if($ufile !=none)
    {
    if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
    {
    echo ("Successful<BR />");

    //$new_file_name = new file name
    //$HTTP_POST_FILES['ufile']['size'] = file size
    //$HTTP_POST_FILES['ufile']['type'] = type of file
    echo ("File Name :".$new_file_name."<BR />0");
    echo ("File Size :".$HTTP_POST_FILES['ufile']['size']."<BR />");
    echo ("File Type :".$HTTP_POST_FILES['ufile']['type']."<BR />");
    }
    else
    {
    echo ("Error");
    }
    }
    break;
    }
    echo("<br /><br /><a href=\"song.php?song=upload\">Add</a></b>");
    ?>[/code]

    This is my code, but when I go to upload a song on it, it takes a while as if it is uploading it but then it comes up with the page "Cannot Connect To Server".

    Thankyou,
    Luke
    [/quote]

    bump
  6. [code]<?
    //ob_start();
    //the above line needs to be above ALL HTML and PHP (except for <?).
    //include("config.php");
    //gets the config page, which connects to the database and gets the user's information
    //if ($logged[username])
    //{
    //checks to see if they are logged in
    switch($_GET[song])
    {
    //this allows us to use one page for the entire thing
    default:
    break;

    case 'upload':
    echo ("<form action=\"song.php?song=add\" enctype=\"multipart/form-data\" method=\"post\"><br />
    Select file
    <input name=\"ufile\" type=\"file\" size=\"50\">
    <input type=\"submit\" name=\"Upload\" value=\"Upload\">
    </form>");

    break;

    case 'add':
    $valid = array (".mp3",".wma");

    $type = strtolower(strstr($filename, '.'));
    if (!in_array($type, $valid)) {
    echo ("The submitted file was of invalid type.<br />");
    }

    $file_name = $HTTP_POST_FILES['ufile']['name'];
    $random_digit=rand(00000000,99999999);
    $new_file_name=$file_name.$random_digit;

    //set where you want to store files
    //in this example we keep file in folder upload
    //$new_file_name = new upload file name
    //for example upload file name cartoon.gif . $path will be upload/cartoon.gif
    $path= "songs/".$new_file_name;
    if($ufile !=none)
    {
    if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
    {
    echo ("Successful<BR />");

    //$new_file_name = new file name
    //$HTTP_POST_FILES['ufile']['size'] = file size
    //$HTTP_POST_FILES['ufile']['type'] = type of file
    echo ("File Name :".$new_file_name."<BR />0");
    echo ("File Size :".$HTTP_POST_FILES['ufile']['size']."<BR />");
    echo ("File Type :".$HTTP_POST_FILES['ufile']['type']."<BR />");
    }
    else
    {
    echo ("Error");
    }
    }
    break;
    }
    echo("<br /><br /><a href=\"song.php?song=upload\">Add</a></b>");
    ?>[/code]

    This is my code, but when I go to upload a song on it, it takes a while as if it is uploading it but then it comes up with the page "Cannot Connect To Server".

    Thankyou,
    Luke
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.