|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-10-12 11:47 UTC] wez@php.net
[2006-02-27 07:35 UTC] mike@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 20:00:01 2025 UTC |
Description: ------------ <form enctype="multipart/form-data" action="display.php? tryb=1" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="10000000000000000" /> Choose a file to upload: <input name="userfile" type="file" /> <input type="submit" value="Upload File" /> </form> <?php if ($_GET['tryb']==1) { $fp = fopen($_FILES['userfile']['tmp_name'], 'rb'); echo $_FILES['userfile']['error']; $pdo = new PDO("sqlite:/sqlite3.sdb"); $stmt = $pdo->prepare("insert into zdjecia (lp_zdjecia, zdjecie, polozenie) values (?, ?, ?)"); $id = 1; // some function to allocate a new ID $tekst="test"; // assume that we are running as part of a file upload form // You can find more information in the PHP documentation $stmt->bindParam(1, $id); $stmt->bindParam(2, $fp, PDO_PARAM_LOB); $stmt->bindParam(3, $tekst); $stmt->execute(); } ?> Expected result: ---------------- It should insert image into db.