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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dva at vlas dot ru
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu May 08 02:01:27 2025 UTC