php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
48 - 28 = ?
Subscribe to this entry?

 
 [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);

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 10:01:30 2024 UTC