File: upload.php

Recommend this page to a friend!
  Classes of Pavel   File Drop   upload.php   Download  
File: upload.php
Role: Auxiliary data
Content type: text/plain
Description: Demo upload script used with the demo page.
Class: File Drop
Handle file upload drag and drop operations
Author: By
Last change: Accessible without user login
Date: 12 years ago
Size: 1,024 bytes
 

Contents

Class file image Download
<?php $charset = '; charset=utf-8'; $callback = &$_REQUEST['fd-callback']; if (!empty($_FILES['fd-file']) and is_uploaded_file($_FILES['fd-file']['tmp_name'])) { $name = $_FILES['fd-file']['name']; $data = file_get_contents($_FILES['fd-file']['tmp_name']); $accept = &$_SERVER['HTTP_ACCEPT_CHARSET']; $accept and $charset = '; charset='.strtok(strtok($accept, ';'), ','); } else { $name = urldecode($_SERVER['HTTP_X_FILE_NAME']); $data = file_get_contents("php://input"); } $output = sprintf('%s; received %d bytes, CRC32 = %08X, MD5 = %s', $name, strlen($data), crc32($data), strtoupper(md5($data))); if ($callback) { header('Content-Type: text/html'.$charset); $output = addcslashes($output, "\\\"\0..\x1F"); echo '<!DOCTYPE html><html><head></head><body><script type="text/javascript">', "try { window.top.$callback(\"$output\"); } catch (e) { }</script></body></html>"; } else { header('Content-Type: text/plain'.$charset); echo $output; }