Jump to content

davie_uk

New Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

davie_uk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I dont seem to be experiencing any errors. I monitor my internet after i hit the submit button; it clearly uploads in some way or form, and IE loads the following page to say upload complete. The destination folder permissions are correct, but nothing appears in the folder. It's left me rather puzzled. http://www.wiltonandbarfordprimaryschool.co.uk/phpinfo.php
  2. I'm hoping someone can help me on this. Ive been using this piece of code for years, but my webserver just got upgrade to PHP5, and now I cant upload any images!! I'm guessing that some elements are no longer compatible in PHP, but havent a clue where to start. Maybe someone with a better trained eye can spot something, apart from my terrible coding skills. Any help would be greatly appreciated. // ....................................... MY UPLOAD SCRIPT STARTS// define ("MAX_SIZE","5000000000"); define ("WIDTH","400"); define ("WIDTHth","75"); function make_thumb($img_name,$filename,$new_w,$new_h) { $ext=getExtension($img_name); if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) $src_img=imagecreatefromjpeg($img_name); if(!strcmp("png",$ext)) $src_img=imagecreatefrompng($img_name); $old_x=imageSX($src_img); $old_y=imageSY($src_img); $ratio1=$old_x/$new_w; $ratio2=$old_y/$new_h; if($ratio1>$ratio2) { $thumb_w=$new_w; $thumb_h=$old_y/$ratio1; } else { $thumb_h=$new_h; $thumb_w=$old_x/$ratio2; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if(!strcmp("png",$ext)) imagepng($dst_img,$filename); else imagejpeg($dst_img,$filename); imagedestroy($dst_img); imagedestroy($src_img); } function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $errors=0; if(isset($_POST['btn_welcomepic'])) { $image=$_FILES['nwbpswelcomepic_pic']['name']; if ($image) { $filename = stripslashes($_FILES['nwbpswelcomepic_pic']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png")) { echo '<h1>Unknown extension!</h1>'; $errors=1; } else { $size=getimagesize($_FILES['nwbpswelcomepic_pic']['tmp_name']); $sizekb=filesize($_FILES['nwbpswelcomepic_pic']['tmp_name']); if ($sizekb > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } $image_name=time().'.'.$extension; $newname="test/".$image_name; $copied = copy($_FILES['nwbpswelcomepic_pic']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; } else { $imgphoto='photo_'.$image_name; $thumb_name='../../../images/welcome/photo_'.$image_name; $thumb=make_thumb($newname,$thumb_name,WIDTH); $imgthumb='thumb_'.$image_name; $thumb_name='../../../images/welcome/thumb_'.$image_name; $thumb=make_thumb($newname,$thumb_name,WIDTHth); $deleteimagefile="../../../images/welcome/".$image_name; unlink($deleteimagefile); }} }} // ....................................... MY UPLOAD SCRIPT ENDS//
  3. Hey kids, quick question... how would I go about using radio buttons or any other form of button, to include or exclude an image upload, within a form? any help would be most appreciated David
×
×
  • 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.