TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   [Question] why does my script have this error (http://www.talkphp.com/general/1211-question-why-does-my-script-have-error.html)

luk3 09-23-2007 05:41 PM

[Question] why does my script have this error
 
I recently purchased a script called PHPix and ive uploaded it.

www.hairscene.net/hotornot/

and when it comes to the image uploading part, it wont upload the images, try it for yourself and see

www.hairscene.net/hotornot/signup.php

it says to upload a valid file type, which i did. An ideas?

thanks

Karl 09-23-2007 06:25 PM

What type of file did you upload? Without looking at the script, the error implies that the file type you uploaded is not a valid type for the script. For example, you tried to upload a .txt document when the script only expects .jpg images.

luk3 09-23-2007 07:25 PM

no i have uploaded a jpg file,... and it says it is the wrong file type and i should only upload, jpg,png or gif images

Karl 09-23-2007 07:55 PM

I think it may be that the extension must be uppercase. I tried to upload an image with an upper case extension (i.e. picture.JPG instead of picture.jpg) and the script did something, although it still didn't work - this time it just timed out after about 30 seconds.

luk3 09-23-2007 07:59 PM

nope i just tried that, but the same error

Karl 09-23-2007 11:03 PM

There isn't really much more I can suggest without seeing the code. I would personally contact the guy who you bought the script from and ask for some assistance.

codefreek 09-24-2007 02:47 PM

its easyer if you would like explain some more,
and maybe show bits of the code and try to get a error
error is more useful to go on..
Codefreek.

luk3 09-24-2007 03:46 PM

*EDIT* i think this is where the image upload is

Quote:


function is_uploaded_fil($filename) { // function for PHP versions < 4.0.3

if (!$tmp_file = get_cfg_var('upload_tmp_dir')) {
$tmp_file = dirname(tempnam('', ''));
}
$tmp_file .= '/' . basename($filename);
return (ereg_replace('/+', '/', $tmp_file) == $filename);
}


$username = strtolower($username);
if(!$username) { $message .= NOUSERNAME."<br>";}
if(!$password) { $message .= NOPASS."<br>"; }
if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))) $message .= ENTEREMAIL."<BR>";

if ($submitpic != "no" ) {if((strlen($url) <= 8) && !$userpic) $message .= NOURL."<br>"; }

// if(!$age) $message .= "Your age was not entered.<br>";
if(!$category) $message .= NOCAT."<br>";
if ($submitpic != "no") {if(!$describe) $message .= NODESCRIP."<br>";}
if(!$self) $self=5;
if (userexists($username)) $message .= USEREXISTS."<br>";
if (sitexists($url) && !$userpic && $submitpic != "no") $message .= IMGEXISTS."<br>";
if (isset($aself)) $message .= "<br><ID#>";
$resize = "no";
if (!isset($submitpic)) $submitpic ="yes";

if ($submitpic == "yes" && !$message ) {

if (strlen($url) <= 8 && $allowupload != 0 ) { // begin file upload routine
$source = $HTTP_POST_FILES['userpic']['tmp_name'];
$dest = '';
if (($source != 'none') && ($source != '' )) {
$newfile = uniqid('img').'';
$dest = $uploadpath.$newfile;
if (ereg( "[4-9]\.[0-9]\.[3-9].*", phpversion() ) || ereg( "[4-9]\.[1-9]\.[0-9].*", phpversion() )) {
if ( $dest != '' ) {
if ( move_uploaded_file( $source, $dest ) ) {$url = $uploadurl.$newfile;}
else $message .= FILENOTSTORED."<BR>";
if (isset($chmod)) chmod ($dest, 0755); // some servers will require this line
}
}else {
if ( $dest != '' ) {
if (is_uploaded_fil($source)) { copy($source, $dest); $url = $uploadurl.$newfile;}
if (isset($chmod)) chmod ($dest, 0755); // some servers will require this line
}
}

}
else $message = FILETOOBIG;

$imagesize = @getimagesize($dest);
switch ( $imagesize[2] ) {
case 1:
rename($dest, $dest.".gif");
$url.= ".gif";
break;
case 2:
rename($dest, $dest.".jpg");
$url.= ".jpg";
$dest .= ".jpg";
addlogo();
$jpg = 1;
break;
case 3:
rename($dest, $dest.".png");
$url.= ".png";
break;
default:
$message = INVALIDIMG;
@unlink($dest);
break;
}


if ( $imagesize[0] > $imgsize) $resize = "yes";
if ( $source_size > ($uploadsize * 1024) ) $message .= FILETOOBIG;
if ( filesize($dest) > ($uploadsize * 1024) ) { unlink($dest); $message .= FILETOOBIG; }

} // end file upload routine
}



All times are GMT. The time now is 07:09 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0