" /> Uploader Script [TUT]


Page 3 of 3 FirstFirst 123
Results 21 to 29 of 29
  1. #21
    Join Date
    Aug 2007
    Location
    Scotland
    Posts
    1,708
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    $siteurl "http://www.lexet.hostingme.co.uk/uploaded"//Include http:// and www. ending in where the images upload to with NO trailing slash
    $serverpath "uploaded/"// The End of the part above WITH trailing slash 
    is what it is o.O

  2. #22
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    That is fine.

    Don't know whats wrong then


  3. #23
    Join Date
    Aug 2007
    Location
    Scotland
    Posts
    1,708
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?
    // CONFIG
    // Uploader Script made by E-Ash off Habbo UK
    $siteurl "http://www.lexet.hostingme.co.uk/uploaded"//Include http:// and www. ending in where the images upload to with NO trailing slash
    $serverpath "uploaded/";   // The End of the part above WITH trailing slash
    $urltoimages "$siteurl";  // Web address to where the images are accessible from.
    $maxsize "51200";     // Maximum size of the file people can upload
    $uniq uniqid("");
    // CONFIG END
     
     
    $mode $_GET['mode'];
    if (
    $mode == "") { $mode "form"; }
     
     
    if (
    $mode == "form") {
    echo 
    "<form enctype='multipart/form-data' method='post' action='upload.php?mode=upload'>\n";
    echo 
    "Upload file: <input type='file' name='file'>\n";
    echo 
    "<br><input type='submit' name='Submit' value='Upload'>\n";
    $bytesize "1024";
    $kb $maxsize/$bytesize;
    echo 
    "<br>Maximum File Size: $kb Kilobytes <em>($maxsize Bytes)</em>";
    }  
     
     
     
     
    if (
    $mode == "upload") {
    $file $_FILES['file']['name'];
    $name time() . substr($file, -4);
     
    // If you add your own file types don't forget to add an uppercase version.
     
    $allowedfiles[] = "gif";
     
    $allowedfiles[] = "jpg";
     
    $allowedfiles[] = "jpeg";
     
    $allowedfiles[] = "jfef";
     
    $allowedfiles[] = "jpe";
     
    $allowedfiles[] = "png";
     
    $allowedfiles[] = "GIF";
     
    $allowedfiles[] = "JPG";
     
    $allowedfiles[] = "JPEG";
     
    $allowedfiles[] = "JFEF";
     
    $allowedfiles[] = "JPE";
     
    $allowedfiles[] = "PNG";
     
    $allowedfiles[] = "PDF";
     
    $allowedfiles[] = "pdf";
     
    $allowedfiles[] = "PSD";
     
    $allowedfiles[] = "psd";
     
    $allowedfiles[] = "bmp";
     
    $allowedfiles[] = "BMP";
     
    $allowedfiles[] = "tif";
     
    $allowedfiles[] = "tiff";
     
    $allowedfiles[] = "TIF";
     
    $allowedfiles[] = "TIFF";
     
    $allowedfiles[] = "dib";
     
    $allowedfiles[] = "DIB"
     
     
     if(
    $_FILES['file']['size'] > $maxsize)
     {
      print 
    "File size is too big -  reduce file size and try again.";
      }
      else {
      
    $path "$serverpath$name;
      foreach(
    $allowedfiles as $allowedfile) {
     
      if (
    $done <> "yes") {
      if (
    file_exists($path)) {
       echo 
    "A file with this name already exists - please rename the file and reupload.";
       exit;
      }
      }
     
      if (
    substr($file, -3) == $allowedfile) {
        
    move_uploaded_file($_FILES['file']['tmp_name'], "$path");
        
    $done "yes";
        echo 
    "<p>Your image has been successfully uploaded to our server and can be accessed using the URL provided below.</p>";
        echo 
    "<p>Please Note we do not take any responsibility of the images that you upload</p>";
    ?>
    <!-- All the kinds of code you want to be outputed go here -->
    <img src="<?php echo "$urltoimages/$name?>">
    <br>Direct Link: <input name='direct' type='text' align='center' size='70' value='<?php echo "$urltoimages/$name?>'>
    <br>    BB Code:<input name='bbcode1' type='text' align='center' size='70' value='[img=<?php echo "$urltoimages/$name?>]'>
    <br>    BB Code:     <input name='bbcode2' type='text' align='center' size='70' value='[img]<?php echo "$urltoimages/$name?>[/img]'>
    <br>    HTML Code:     <input name='html1' type='text' align='center' size='70' value='<img src="<?php echo "$urltoimages/$name?>">'>
    <br>    HTML Code:     <input name='html2' type='text' align='center' size='70' value='<img src="<?php echo "$urltoimages/$name?>"><img>'>
    <!-- End of all HTML Code -->
    <?php
     
        
    }
     
     
      }
     
     
    if (
    $done <> "yes") { print "<p><b>Error:</b> Your image as not been uploaded becuase it is not a recognised image file. Please try again.</p>"; }
    }
    }
    ?>
    is the full thing o.O

    it says error with this line

    PHP Code:
        move_uploaded_file($_FILES['file']['tmp_name'], "$path"); 

    Site: http://lexet.hostingme.co.uk/upload.php
    Last edited by Galaxay1; 12-08-2007 at 11:48 AM.

  4. #24
    Join Date
    Jul 2006
    Location
    Athens
    Posts
    842
    Tokens
    0

    Default

    Works For me


  5. #25
    Join Date
    Sep 2007
    Posts
    188
    Tokens
    0

    Default

    <?
    // Script Made By Ashley Cusack
    // CONFIG
    $siteurl = "http://www.habbocouncil.co.uk/images"; //Must Include http:// and www. ending in where the images upload to with NO trailing slash
    $serverpath = "images/"; // The End of the part above
    $urltoimages = "$siteurl"; // Web address to where the images are accessible from.
    $maxsize = "500000"; // Maximum size of the file people can upload
    $uniq = uniqid("");
    // CONFIG END

    $mode = $_GET['mode'];
    if ($mode == "") { $mode = "form"; }

    if ($mode == "form") {
    echo "<form enctype='multipart/form-data' method='post' action='upload.php?mode=upload'>\n";
    echo "Upload file: <input type='file' name='file'>\n";
    echo "<br><input type='submit' name='Submit' value='Upload'>\n";
    $bytesize = "1000";
    $kb = $maxsize/$bytesize;
    echo "<br>Maximum File Size: $kb Kilobytes <em>($maxsize Bytes)</em>";
    }
    if ($mode == "upload") {
    $file = $_FILES['file']['name'];
    $name = time() . substr($file, -4);
    // If you add your own file types don't forget to add an uppercase version.
    $allowedfiles[] = "gif";
    $allowedfiles[] = "jpg";
    $allowedfiles[] = "jpeg";
    $allowedfiles[] = "jfef";
    $allowedfiles[] = "jpe";
    $allowedfiles[] = "png";
    $allowedfiles[] = "GIF";
    $allowedfiles[] = "JPG";
    $allowedfiles[] = "JPEG";
    $allowedfiles[] = "JFEF";
    $allowedfiles[] = "JPE";
    $allowedfiles[] = "PNG";
    $allowedfiles[] = "PDF";
    $allowedfiles[] = "pdf";
    $allowedfiles[] = "PSD";
    $allowedfiles[] = "psd";
    $allowedfiles[] = "bmp";
    $allowedfiles[] = "BMP";
    $allowedfiles[] = "tif";
    $allowedfiles[] = "tiff";
    $allowedfiles[] = "TIF";
    $allowedfiles[] = "TIFF";
    $allowedfiles[] = "dib";
    $allowedfiles[] = "DIB";


    if($_FILES['file']['size'] > $maxsize)
    {
    print "File size is too big - please reduce file size and try again.";
    }
    else {
    $path = "$serverpath/" . $name;
    foreach($allowedfiles as $allowedfile) {

    if ($done <> "yes") {
    if (file_exists($path)) {
    echo "A file with this name already exists - please rename the file and reupload.";
    exit;
    }
    }

    if (substr($file, -3) == $allowedfile) {
    move_uploaded_file($_FILES['file']['tmp_name'], "$path");
    $done = "yes";
    echo "<p>Your image has been successfully uploaded to our server and can be accessed using the URL provided below.</p>";
    echo "<p>Please Note we do not take any responsibility of the images that you upload</p>";
    ?>
    <!-- All the kinds of code you want to be outputed go here --><br>
    Direct Link: <input name='direct' type='text' align='center' size='70' value='<?php echo "$urltoimages/$name" ?>'>
    <br>
    BB Code: -
    <input name='bbcode1' type='text' align='center' size='70' value='[img=<?php echo "$urltoimages/$name" ?>]'>
    <br>
    BB Code: -
    <input name='bbcode2' type='text' align='center' size='70' value='[img]<?php echo "$urltoimages/$name" ?>[/img]'>
    <!-- End of all HTML Code -->
    <?php

    }

    }

    if ($done <> "yes") { print "<p><b>Error:</b> Your image as not been uploaded becuase it is not a recognised image file. Please try again.</p>"; }
    }
    }
    ?>
    www.habbocouncil.co.uk - I go to upload something come up with a 404 error? Can any one help + rep

  6. #26
    Join Date
    Jul 2005
    Location
    North Wales
    Posts
    4,233
    Tokens
    2,009

    Latest Awards:

    Default

    PHP Code:
    <?
    // Script Made By Ashley Cusack
    // CONFIG
    $siteurl "http://www.habbocouncil.co.uk/images"//Must Include http:// and www. ending in where the images upload to with NO trailing slash
    $serverpath "images/"// The End of the part above
    $urltoimages "$siteurl"// Web address to where the images are accessible from.
    $maxsize "500000"// Maximum size of the file people can upload
    $uniq uniqid("");
    // CONFIG END

    $mode $_GET['mode'];
    if (
    $mode == "") { $mode "form"; }

    if (
    $mode == "form") {
    echo 
    "<form enctype='multipart/form-data' method='post'>\n";
    echo 
    "Upload file: <input type='file' name='file'>\n";
    echo 
    "<br><input type='submit' name='Submit' value='Upload'>\n";
    $bytesize "1000";
    $kb $maxsize/$bytesize;
    echo 
    "<br>Maximum File Size: $kb Kilobytes <em>($maxsize Bytes)</em>";
    }
    if (
    $mode == "upload") {
    $file $_FILES['file']['name'];
    $name time() . substr($file, -4);
    // If you add your own file types don't forget to add an uppercase version.
    $allowedfiles[] = "gif";
    $allowedfiles[] = "jpg";
    $allowedfiles[] = "jpeg";
    $allowedfiles[] = "jfef";
    $allowedfiles[] = "jpe";
    $allowedfiles[] = "png";
    $allowedfiles[] = "GIF";
    $allowedfiles[] = "JPG";
    $allowedfiles[] = "JPEG";
    $allowedfiles[] = "JFEF";
    $allowedfiles[] = "JPE";
    $allowedfiles[] = "PNG";
    $allowedfiles[] = "PDF";
    $allowedfiles[] = "pdf";
    $allowedfiles[] = "PSD";
    $allowedfiles[] = "psd";
    $allowedfiles[] = "bmp";
    $allowedfiles[] = "BMP";
    $allowedfiles[] = "tif";
    $allowedfiles[] = "tiff";
    $allowedfiles[] = "TIF";
    $allowedfiles[] = "TIFF";
    $allowedfiles[] = "dib";
    $allowedfiles[] = "DIB";


    if(
    $_FILES['file']['size'] > $maxsize)
    {
    print 
    "File size is too big - please reduce file size and try again.";
    }
    else {
    $path "$serverpath/" $name;
    foreach(
    $allowedfiles as $allowedfile) {

    if (
    $done <> "yes") {
    if (
    file_exists($path)) {
    echo 
    "A file with this name already exists - please rename the file and reupload.";
    exit;
    }
    }

    if (
    substr($file, -3) == $allowedfile) {
    move_uploaded_file($_FILES['file']['tmp_name'], "$path");
    $done "yes";
    echo 
    "<p>Your image has been successfully uploaded to our server and can be accessed using the URL provided below.</p>";
    echo 
    "<p>Please Note we do not take any responsibility of the images that you upload</p>";
    ?>
    <!-- All the kinds of code you want to be outputed go here --><br>
    Direct Link: <input name='direct' type='text' align='center' size='70' value='<?php echo "$urltoimages/$name?>'>
    <br> 
    BB Code: - 
    <input name='bbcode1' type='text' align='center' size='70' value='[img=<?php echo "$urltoimages/$name?>]'>
    <br> 
    BB Code: - 
    <input name='bbcode2' type='text' align='center' size='70' value='[img]<?php echo "$urltoimages/$name?>[/img]'>
    <!-- End of all HTML Code -->
    <?php

    }

    }

    if (
    $done <> "yes") { print "<p><b>Error:</b> Your image as not been uploaded becuase it is not a recognised image file. Please try again.</p>"; }
    }
    }
    ?>
    That should do it.

  7. #27
    Join Date
    Sep 2007
    Posts
    188
    Tokens
    0

    Default

    www.habbocouncil.co.uk - Works but does not show the link, you see what i mean?

  8. #28
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Okay, what about having the extension .gif but the actual type is not an image/bla its an application/

  9. #29
    Join Date
    Sep 2007
    Posts
    188
    Tokens
    0

    Default

    <?
    // Script Made By Ashley Cusack
    // CONFIG
    $siteurl = "http://www.habbocouncil.co.uk/images"; //Must Include http:// and www. ending in where the images upload to with NO trailing slash
    $serverpath = "images/"; // The End of the part above
    $urltoimages = "$siteurl"; // Web address to where the images are accessible from.
    $maxsize = "500000"; // Maximum size of the file people can upload
    $uniq = uniqid("");
    // CONFIG END

    $mode = $_GET['mode'];
    if ($mode == "") { $mode = "form"; }

    if ($mode == "form") {
    echo "<form enctype='multipart/form-data' method='post'>\n";
    echo "Upload file: <input type='file' name='file'>\n";
    echo "<br><input type='submit' name='Submit' value='Upload'>\n";
    $bytesize = "1000";
    $kb = $maxsize/$bytesize;
    echo "<br>Maximum File Size: $kb Kilobytes <em>($maxsize Bytes)</em>";
    }
    if ($mode == "upload") {
    $file = $_FILES['file']['name'];
    $name = time() . substr($file, -4);
    // If you add your own file types don't forget to add an uppercase version.
    $allowedfiles[] = "gif";
    $allowedfiles[] = "jpg";
    $allowedfiles[] = "jpeg";
    $allowedfiles[] = "jfef";
    $allowedfiles[] = "jpe";
    $allowedfiles[] = "png";
    $allowedfiles[] = "GIF";
    $allowedfiles[] = "JPG";
    $allowedfiles[] = "JPEG";
    $allowedfiles[] = "JFEF";
    $allowedfiles[] = "JPE";
    $allowedfiles[] = "PNG";
    $allowedfiles[] = "PDF";
    $allowedfiles[] = "pdf";
    $allowedfiles[] = "PSD";
    $allowedfiles[] = "psd";
    $allowedfiles[] = "bmp";
    $allowedfiles[] = "BMP";
    $allowedfiles[] = "tif";
    $allowedfiles[] = "tiff";
    $allowedfiles[] = "TIF";
    $allowedfiles[] = "TIFF";
    $allowedfiles[] = "dib";
    $allowedfiles[] = "DIB";


    if($_FILES['file']['size'] > $maxsize)
    {
    print "File size is too big - please reduce file size and try again.";
    }
    else {
    $path = "$serverpath/" . $name;
    foreach($allowedfiles as $allowedfile) {

    if ($done <> "yes") {
    if (file_exists($path)) {
    echo "A file with this name already exists - please rename the file and reupload.";
    exit;
    }
    }

    if (substr($file, -3) == $allowedfile) {
    move_uploaded_file($_FILES['file']['tmp_name'], "$path");
    $done = "yes";
    echo "<p>Your image has been successfully uploaded to our server and can be accessed using the URL provided below.</p>";
    echo "<p>Please Note we do not take any responsibility of the images that you upload</p>";
    ?>
    <!-- All the kinds of code you want to be outputed go here --><br>
    Direct Link: <input name='direct' type='text' align='center' size='70' value='<?php echo "$urltoimages/$name" ?>'>
    <br>
    BB Code: -
    <input name='bbcode1' type='text' align='center' size='70' value='[img=<?php echo "$urltoimages/$name" ?>]'>
    <br>
    BB Code: -
    <input name='bbcode2' type='text' align='center' size='70' value='[img]<?php echo "$urltoimages/$name" ?>[/img]'>
    <!-- End of all HTML Code -->
    <?php

    }

    }

    if ($done <> "yes") { print "<p><b>Error:</b> Your image as not been uploaded becuase it is not a recognised image file. Please try again.</p>"; }
    }
    }
    ?>
    I think im missing something. Can any one help +rep to all help
    www.upload.uk.tp
    Last edited by Save; 03-10-2007 at 08:29 PM.

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •