pic uploader

Started on the old forum in September 2010 · view the original in the archive · old links redirect here

9 replies · 1,065 views · started 16 years ago · 1 min read

4 participants
rayjee Developer · 99 posts #3

Classupload

something else wrote: dont use gd.... show us ur script :P

how to rem0ve that? And i found GD FUNCTI0N n the classUpload
HERE

/** * Returns the version of GD * * Access public * @return float GD version */ function gd_version() { static $gd_version = null; if ($gd_version === null) { if (function_exists('gd_info')) { $gd = gd_info(); $gd = $gd["GD Version"]; $regex = "/([\d.]+)/i"; } else { ob_start(); phpinfo(8); $gd = ob_get_contents(); ob_end_clean(); $regex = "/\bgd\s+version\b[^\d\n\r]+?([\d.]+)/i"; } if (preg_match($regex, $gd, $m)) { $gd_version = (float) $m[1]; } else { $gd_version = 0; } } return $gd_version; }

dis is the problem or n0t?

Added after 10 minutes:

and dis s the UPLOAD.Php

//////////////////////////////////Members List

error_reporting(E_ALL);

// we first include the upload class, as we will need it here to deal with the uploaded file

$userinfo = mysql_fetch_array(mysql_query("SELECT name, sex FROM yggrassil_users WHERE id='".$uid."'")); $membername = $userinfo[0];

// we have three forms on the test page, so we redirect accordingly if ($_POST['action'] == 'image') {

$pid = $_POST["pid"];

echo "<head>"; echo "<title>Mobile Kawap</title>"; echo "<link rel="stylesheet" type="text/css" href="style.css">"; echo "</head>"; echo "<body>"; echo " ";

// ---------- IMAGE UPLOAD ----------

// we create an instance of the class, giving as argument the PHP object 
// corresponding to the file field from the form
// All the uploads are accessible from the PHP object $_FILES
$handle = new Upload($_FILES['my_field']);

// then we check if the file has been uploaded properly
// in its *temporary* location in the server (often, it is /tmp)
if ($handle->uploaded) {
    
    // yes, the file is on the server
    // below are some example settings which can be used if the uploaded file is an image.
    $handle->image_resize            = true;
    $handle->image_ratio_y           = true;
    $handle->image_x                 = 100;

    // now, we start the upload 'process'. That is, to copy the uploaded file
    // from its temporary location to the wanted location
    // It could be something like $handle->Process('/home/www/my_uploads/');
    $handle->Process('../pkfiles/');
    
    // we check if everything went OK
    if ($handle->processed) {
        // everything was fine !

        echo '  file uploaded with success

'; echo ' External image (may be gone)file_dst_name . '" /> '; $info = getimagesize($handle->file_dst_pathname); echo ' upload successfully'; $itemurl = "../pkfiles/$handle->file_dst_name";

        if($pid=="1")
        {
        $pid = 1;
        }else{
        $pid = 0;
        }

        $reg = mysql_query("INSERT INTO yggrassil_gallery SET uid='".$uid."', itemurl='".$itemurl."', sex='".$userinfo[1]."', time='".time()."', private='".$pid."'");

    } else {
        // one error occured

        echo '  file not uploaded to the wanted location

'; echo ' Error: ' . $handle->error . ' ';

    }

    // we delete the temporary files
    $handle-> Clean();

} else {
    // if we're here, the upload file failed for some reasons
    // i.e. the server didn't receive the file

    echo '  file not uploaded on the server

'; echo ' Error: ' . $handle->error . ''; }

echo "

"; ////// UNTILL HERE >> echo " "; echo "

<a href="index.php?action=pkgal&sid=$sid">«Back to Gallery</a> "; echo "<a href="index.php?action=main&sid=$sid">"; echo "Home</a>"; echo " ";

echo "</body>";
echo "</html>";
exit();

} ?>

rayjee Developer · 99 posts #4

riderz wrote: just go and create ur folder pkfiles and chmod it to 777

Rider i have already that folder. . im using a freehost b4 and my uploader is ok, but wen im switch n0w to paidhosting the uploader is n0t working? And al avatars and pkfiles turn to a box object only. And tamagotchi level images is n0t appear to0.. Why o why??

something else Fellow · 2,296 posts #5

You have no gd libary installed so you would either have to get it installed or make a work around like this:

<?php

error_reporting(E_ALL); 

$userinfo = mysql_fetch_array(mysql_query("SELECT name, sex FROM yggrassil_users WHERE id='".$uid."'"));
$membername = $userinfo[0];
if ($_POST['action'] == 'image') {

echo "<head>";
echo "<title>Mobile Kawap</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
move_uploaded_file($_FILES['my_field']['tmp_name'] ,'../pkfiles/'.$_FILES['my_field']['name']);
echo ' file uploaded with success<br/>';
echo ' <img src="../pkfiles/' . $_FILES['my_field']['name'] . '" /><br/>';
if($_POST["pid"]==1)
{
$pid = 1;
}else{
$pid = 0;
}

$reg = mysql_query("INSERT INTO yggrassil_gallery SET uid='".$uid."', itemurl='../pkfiles/'".$_FILES['my_field']['name']."', sex='".$userinfo[1]."', time='".time()."', private='".$pid."'");

echo "</p>"; 
////// UNTILL HERE >> 
echo "<p align=\"center\">";
echo "<br/><br/><a href=\"index.php?action=pkgal&sid=$sid\">&#171 ;Back to Gallery</a><br/>";
echo "<a href=\"index.php?action=main&sid=$sid\">";
echo "Home</a>";
echo "</p>";

echo "</body>";
echo "</html>";
exit();
}
?>

this isnt a very secure uploader ^^^^ search for gallery uploaders on here there is plenty of them

Vayne Developer · 106 posts #6

search in google for GDlib compilation for your php.

Nous Ne Dansos Pas, Nous Sommes Le Danse.!

rayjee Developer · 99 posts #7

Guys

Tnx sumthing else and all, its to0 hard for a newbeast like me to add a new c0de like u post =( can u explain me why is n0t workin n0w my uploader in the paid hosting? . . Bcuz i use freehost b4 and its ok.. . N0w all in pkfiles folder and avatar folder and images turn all to "BOX OBJECT" ONLY . . Lol

something else Fellow · 2,296 posts #8

Gd library is for changing your pictures ... eg adding a watermark or resize or combining 2 pictures together to create 1 etc.... you could try asking your host to install it..... im guessing on the free host it was already installed

khan Lead · 681 posts #9

rayjee wrote: Tnx sumthing else and all, its to0 hard for a newbeast like me to add a new c0de like u post =( can u explain me why is n0t workin n0w my uploader in the paid hosting? . . Bcuz i use freehost b4 and its ok.. . N0w all in pkfiles folder and avatar folder and images turn all to "BOX OBJECT" ONLY . . Lol

On your free host GD worked as because Your Free Host Provider Installed GD Library On Their Server. But It Seems Your Paid Host Provider Hasn't Install GD Library. Thats why You Can't Use GD. In this Case You Can Contact With Your Host Provider to Install GD On thier Server. Or Don't Use GD.

rayjee Developer · 99 posts #10

thanx

Tnx sumthin else and khan . I get it. . Uhm can i use and edit my smiley uploader to upload a picture? And redirect to pkfiles folder?? Or can u gave me a link here a secured photo uploader have a reziser?. . Thanks f0r your post reply =)

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close