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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

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: Thu Mar 28 13:01:28 2024 UTC