<?php use PhpSolutions\File\Upload; // set the maximum upload size in bytes $max = 51200; if (isset($_POST['upload'])) { // define the path to the upload folder $destination = 'C:/upload_test/'; require_once '../PhpSolutions/File/Upload.php'; try { $loader = new Upload($destination); $loader->upload(); $result = $loader->getMessages(); } catch (Exception $e) { echo $e->getMessage(); } } ?> <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Upload File</title> </head> <body> <?php if (isset($result)) { echo '<ul>'; foreach ($result as $message) { echo "<li>{$message}</li>";
<?php use PhpSolutions\File\Upload; // set the maximum upload size in bytes $max = 600 * 1024; // 600 KB if (isset($_POST['upload'])) { // define the path to the upload folder $destination = $_SERVER['DOCUMENT_ROOT'] . "/2t/2601983359/VefRemi/Gallery/"; require_once '/PhpSolutions/File/Upload.php'; try { $loader = new Upload($destination); $loader->setMaxSize($max); $loader->allowAllTypes(); $loader->upload(); $result = $loader->getMessages(); } catch (Exception $e) { echo $e->getMessage(); } } ?> <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Upload File</title> </head> <body> <?php if (isset($result)) {
$meetingfee="汇款缴纳"; break; default: $meetingfee=""; } */ // set the maximum upload size in bytes use PhpSolutions\File\Upload; // set the maximum upload size in bytes $max = 60000 * 1024; // 60 MB if (isset($_FILES['uploadFile'])) { // define the path to the upload folder $destinationFile = 'uploads/file/'; try { $loaderFile = new Upload($destinationFile, 'uploadFile'); $loaderFile->setMaxSize($max); $loaderFile->allowAllTypes(); $loaderFile->upload(); $uploadFile1 = $loaderFile->getName(); $resultFile = $loaderFile->getMessages(); $_SESSION['uploadFile'] = $uploadFile1; } catch (Exception $e) { echo $e->getMessage(); } if (!empty($uploadFile1)) { $uploadsFile = $destinationFile . $uploadFile1; } else { $uploadsFile = ""; } }
<?php use PhpSolutions\File\Upload; require_once '../includes/connection.php'; // create database connection $conn = dbConnect('write', 'pdo'); if (isset($_POST['insert'])) { // initialize flag $OK = false; if (isset($_POST['upload_new']) && $_FILES['image']['error'] == 0) { $imageOK = false; require_once '../PhpSolutions/File/Upload.php'; $loader = new Upload('../images/'); $loader->upload(); $names = $loader->getFilenames(); // $names will be an empty array if the upload failed if ($names) { // use named placeholders $sql = 'INSERT INTO images (filename, caption) VALUES (:filename, :caption)'; $stmt = $conn->prepare($sql); $stmt->bindParam(':filename', $names[0], PDO::PARAM_STR); $stmt->bindParam(':caption', $_POST['caption'], PDO::PARAM_STR); $stmt->execute(); // use rowCount() to get the number of affected rows $imageOK = $stmt->rowCount(); } // get the image's primary key or find out what went wrong if ($imageOK) { // lastInsertId() must be called on the PDO connection object $image_id = $conn->lastInsertId();
public function __construct($path, $deleteOriginal = false) { parent::__construct($path); $this->thumbDestination = $path; $this->deleteOriginal = $deleteOriginal; }