Jump to content

Coding check, will this work?


acctman

Recommended Posts

I'm not able to test the coding below yet, but can someone read over it and tell me if it will work?

 

thanks

 

$upload_path = "/home/site/public_html/temp/";
$filename = $_FILES['Filedata']['tmp_name'];
$ext = explode(".", $filename);
$ext = $ext[count($ext)-1];

if ($_GET['type'] == 'reg') {	

if($ext == '.jpg')
 // if jpg do nothing

if($ext == '.gif')
$res = ImageCreateFromGIF($_FILES['Filedata']['tmp_name']);
imagejpeg($res, $newname);

if($ext == '.bmp')
$res = ImageCreateFromBMP($filename);
imagejpeg($res, $newname);

imagedestroy($res);

if(!move_uploaded_file($newname, $upload_path . session_id() . $ext)) {
header("HTTP/1.0 500 Internal Server Error");
	}

	}

Link to comment
https://forums.phpfreaks.com/topic/95325-coding-check-will-this-work/
Share on other sites

<?php

$upload_path = "/home/site/public_html/temp/";
$filename = $_FILES['Filedata']['tmp_name'];
$ext = $ext[count($ext)-1];






if ($_GET['type'] == 'reg') {

if($ext == '.jpg'){

// if jpg do nothing
}



elseif($ext == '.gif'){



$res = ImageCreateFromGIF($_FILES['Filedata']['tmp_name']);



imagejpeg($res, $newname);}

elseif($ext == '.bmp'){



$res = ImageCreateFromBMP($filename);



imagejpeg($res, $newname);
imagedestroy($res);}


if(!move_uploaded_file($newname, $upload_path . session_id() . $ext)) {

header("HTTP/1.0 500 Internal Server Error");}
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.