|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12041 Incorrect upload graphics files into MySQL when start PHP as Apache module
Submitted: 2001-07-11 04:54 UTC Modified: 2001-07-11 04:57 UTC
From: dva at vlas dot ru Assigned:
Status: Not a bug Package: Apache related
PHP Version: 4.0.6 OS: Windows98
Private report: No CVE-ID: None
 [2001-07-11 04:54 UTC] dva at vlas dot ru
$fd = fopen ($imagefile, "r");
$imagedata = addslashes ( fread ( $fd, filesize ($imagefile) ) );
fclose ($fd);

$link = mysql_connect ($Hostname, $Username, $Password) or die (mysql_errno($link).mysql_error($link));
$db = mysql_select_db ($Database, $link) or die (mysql_errno($link).mysql_error($link));
$query = "INSERT INTO $TableBanner (id, image) VALUES
('NULL', '$imagedata')";
@mysql_query ($query, $link) or die (mysql_errno($link).mysql_error($link));
mysql_close ($link);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-11 04:57 UTC]
You need to fopen the file with the "rb" settings. Windows wants these files opened as binary.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 09:01:32 2024 UTC