Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 10th, 2005, 11:09 PM
Registered User
Join Date: Feb 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with uploading blob data to MySQL DB

Hello, I have a very simple routine for inserting blob data (a jpg) into a MySQL database. I have this page deployed on both my local - WINDOWS server, and my production FreeBSD UNIX server. Both of these implementations point at the same production MySQL server. Running the routine from my local server inserts the BLOB with no problems into the DB, however runing the same exact script from the production server produces the following results:

Warning: fopen(C:\test\test.jpg): failed to open stream: No such file or directory in /urs/www/users/millersh/admin/Edit.php on line 25

The strange this is how this works great on my local windows server. Obviously there is a php value or something that needs to be configured on the production (UNIX) server - I have already tried the following:

php_value magic_quotes_gpc "1" and also "On"
php_value upload_max_filesize "10M"
php_value file_uploads "1" and also "On"
php_value upload_tmp_dir "/usr/www/users/millersh/temp/" (this directory has write access on the server)

The windows server PHP info is as follows:

The UNIX php info is as follows:

PLEASE HELP!!!! I thank you kindly in advance.
Old March 8th, 2005, 06:15 PM
Authorized User
Join Date: Jul 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to merediths


  May a venture a guess ... is your development server also the same box you are testing it from? Here is what I think is going on ... after the file is uploaded you have two variables:

$_FILES['userfile']['name'] <-- original filename
$_FILES['userfile']['tmp_name'] <-- file name on server

 Based on the error you are getting, it looks like you are trying to:

    fopen($_FILES['userfile']['name'] );

instead of

     fopen($_FILES['userfile']['tmp_name'] );

That is why you are showing a Windows-style path on the UNIX server in the error message.
Such a thing would work on the development server if you were testing from a browser on the same box, because


 Would exist on that system. But not from the upload, it would already be there. It has to be, or else you wouldn't have been able to upload it!

Meredith Shaebanyan

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem writing listview data to mysql db method Pro VB 6 2 April 10th, 2007 07:17 PM
inserting BLOB into MySQL DB, carriage newline jcsnyder PHP Databases 1 September 8th, 2006 12:51 PM
problem writing listview data to mysql db method Pro VB Databases 0 May 17th, 2006 06:18 AM
Problem inserting blob data/uploading file - MySQL kyle_shea Beginning PHP 2 February 15th, 2005 10:18 AM
I need help with uploading file to mysql DB superdos PHP Databases 2 June 27th, 2004 01:50 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.