$max_size) # Is it too big? { $error = "File is too big"; } $format = explode( "/", $_FILES[file][type] ); $format = array_pop($format); # Get file type/extension if ( !in_array( "$format", $allowed ) ) # Is it allowed? { $error .= "
File type is not allowed"; } if ( $_FILES[file][error] > 0 ) # Any other error? { $error .= "
A server error occured"; } if ( $error ) # abort if error { $_SESSION[error] = $error; header("location:$self"); exit; } #### continue if no error #### # new name based on session ID $path = "temp/$ID.$_SESSION[views].$format"; # Temporary file name $temp = $_FILES[file][tmp_name]; # move uploaded file move_uploaded_file( "$temp", "$path"); # save data & redirect $_SESSION[path] = $path; header("location:display.php"); exit; } # end file upload ######################## if ( $_GET[url] ) # If transload { $url = trim("$_GET[url]"); # reject if not start with http if ( !preg_match( "@^http@", "$url", $match) ) { $_SESSION[error] = "ERROR: URL's start with http"; header("location:$self"); exit; } # reject if can't read file if ( !@$blob = file_get_contents("$url") ) { $_SESSION[error] = "ERROR: Could not read $url"; header("location:$self"); exit; } # create image object $image = new imagick(); # try to create image from blob try { $image->readImageBlob("$blob"); $format = strtolower( $image->getimageformat() ); $path = "temp/$ID.$_SESSION[views].$format"; $_SESSION[path] = $path; # coalesce if multi frame $frames = $image->getNumberImages(); if ( $frames > 1) { $image = $image->coalesceImages(); } $image->writeimages("$path", TRUE ); header("location:display.php"); exit; } catch ( exception $e ) { $error = $e->getmessage(); } # if error is dedected, show it to user if ( $error ) { $_SESSION[error] = "ERROR: Some kind of error occured. The server says...

$error"; header("location:$self"); exit; } } include("top.php"); ?>

URL:
" method="POST"> ">
  • Limit KB
  • Allowed file types:
    jpg, jpeg, gif, png
Tranload Image
Transload an image from the internet. Enter a valid URL
Upload File
Upload a file from a computer or MSNTV2. WebTV users can upload an image from TV.