Re: [PHP] fopen errors
Hunter, Jess wrote: Thanks for the reply, you are right, the file is going on a Linux box, but the source file is located on the client computer (windoze). You cannot open a remote file by using it's directory path on the remote system. The two ways to do this would be to a) (recommended) open it with a URL, thus the 'client' computer would need to be running a web server, or b) mount the remote drive as a share on the *nix box, and access the file thru the share. http://us4.php.net/manual/en/function.fopen.php The addslashes was part of the original sample script. It was probably made for text to be entered in a db, and in that case (if you are using MySQL), the function mysql_escape_string() would be a better choice... http://us4.php.net/manual/en/function.mysql-escape-string.php The storage would only be temporary, I intend to make it so when the file is viewed, there will be an option to delete it. The binary images would only reside in the DB for 2-4 weeks tops. Most seem to think (including myself) that it is better to store binary files in the file system, and put the text url/path to them in the db. As for your suggestion to modify the script to meet my needs, that is what I am trying to do... Thanks for the assistance Look in the manual for explanations of the functions you're trying to use. Copying an example will rarely do what YOU need/want it to do, and you'll have a better understanding how to modify it by reading how the individual functions work. -Original Message- From: John Nichel [SMTP:[EMAIL PROTECTED] Please don't reply directly to me (or anyone else on the list) unless asked to do so. When you just reply to an individual, your message does not make it into the list archives, and won't be searchable by the next person who comes along with the same problem (that is IF people would actually search the archives). snip -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fopen errors
I have a PHP front end with a MySQL back end with a longblob field. I am thinking the problem exists in the PHP part. Here is the code I am using: $fileHandle = fopen($fileUpload, r); $fileContent = fread($fileHandle, $fileUpload_size); $fileContent = addslashes($fileContent); Then it goes into the Db connection part. When I run the script I get the following error: Warning: fopen(C:\\0-temp\\100_0078.jpg, r) -No such file or directory in /var/www/testbed/httpdocs/blob/grabfile.php on line 41 Warning Supplied argument is not a valid File-Handle resource in /var/www/testbed/httpdocs/blob/grabfile.php on line 45 Then only thing that really jumps out at me in the file source path of C:\\0-temp\\100_0078.jpg there is a couple of extra Backslashes (\) in the path statement. I am using a sample script that pulled from one of the websites. Thanks in Advance, Jess -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen errors
admin wrote: I have a PHP front end with a MySQL back end with a longblob field. Okay? I am thinking the problem exists in the PHP part. Probably not. Here is the code I am using: $fileHandle = fopen($fileUpload, r); $fileContent = fread($fileHandle, $fileUpload_size); $fileContent = addslashes($fileContent); Then it goes into the Db connection part. When I run the script I get the following error: Warning: fopen(C:\\0-temp\\100_0078.jpg, r) -No such file or directory in /var/www/testbed/httpdocs/blob/grabfile.php on line 41 Pretty self explanatory. Warning Supplied argument is not a valid File-Handle resource in /var/www/testbed/httpdocs/blob/grabfile.php on line 45 Direct result of the first error. Then only thing that really jumps out at me in the file source path of C:\\0-temp\\100_0078.jpg there is a couple of extra Backslashes (\) in the path statement. This really should be quite obvious. First, looks as if your script is running on a *nix box, yet you're trying to open a file using a Windoze directory structure. I'm going to say that this won't work. Two, it looks as if you're trying to read in an image...binary file...to enter it into a blob field in MySQL, so why are you going to 'addslashes()' to it? Third.well, I won't open that can of worms about storing your images in the DB I am using a sample script that pulled from one of the websites. You need to modify the script to fit your environment. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fopen errors out when opening a URL
I am trying to do a simple fopen(http://www.weather.com/index.html;, r); For some reason I cannot Open any URL's after trying several. I get the following error Warning: stat failed for Resource id #1 (errno=2 - No such file or directory) I checked my php.ini to make sure I set the fopen wrappers and they are set. Any help would be appreciated. Ryan Conover [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.pitt.edu/~rscst25/ -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fopen errors out when opening a URL
On Tue, Jul 16, 2002 at 11:08:19AM -0400, Conover, Ryan wrote: I am trying to do a simple fopen(http://www.weather.com/index.html;, r); For some reason I cannot Open any URL's after trying several. Warning: stat failed for Resource id #1 (errno=2 - No such file or directory) If you're getting a resource id, your fopen() worked fine. The failure is on some other line in your code. You need to pin down exactly which line it is. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php