Skip to content

Instantly share code, notes, and snippets.

@davewardle

davewardle/upload.php Secret

Last active Jul 11, 2017
Embed
What would you like to do?
File upload
<?php
if (
$_FILES['file']['size'] > 0 &&
is_uploaded_file( $_FILES['file']['tmp_name'] ) &&
preg_match( '/\.(jpe?g|gif|bmp|png)$/i', $_FILES['file']['name'], $m )
) {
// ..
$original_name = $original_name . intval( $artwork_id );
$name_template = $name_template . intval( $artwork_id );
// ...
$output = $original_name.'.jpg'; // the original file
$preview = $name_template.'.preview.jpg'; // the modified files
move_uploaded_file( $_FILES['file']['tmp_name'], $output );
$command = "$convert_location $output -resize 200x200 $preview";
exec( $command );
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.