Re: Problem uploading an image

From: Date: Thu, 04 Jul 2002 23:22:50 +0000
Subject: Re: Problem uploading an image
Groups: php.general 
Request: Send a blank email to php-general+get-105541@lists.php.net to get a copy of this message
>Greetings. > >I have two pages where I upload images to a database. > >The first one is a "capture", where I insert a record to the database, and >the second is to edit the data. > >The problem: When I go to insert, the following code works flawlessly: > ><? >if ($cmdOk == "Save") { > if (isset($imagen) && $imagen != "none") > $data = addslashes(fread(fopen($image, "r"), filesize($image))); > else > $data = ""; >?> > >But, if I do in another page (the same darn snippet), it goes: > >Warning: fopen("C:\WINNT\Web\wuicon1.gif", "r") - No such file or directory >in /web/domain/adconsolutions/htdocs/conexionescolar/frmnoticiasedi.php on line 18 > >Warning: stat failed for C:\WINNT\Web\wuicon1.gif (errno=2 - No such file >or directory) in >/web/domain/adconsolutions/htdocs/conexionescolar/frmnoticiasedi.php on line 18 > >Warning: fread(): supplied argument is not a valid File-Handle resource in >/web/domain/adconsolutions/htdocs/conexionescolar/frmnoticiasedi.php on line 18 > >Anybody knows why? It's the same vars, the same text boxes, etc. The only >thing that changes comes after that condition... After your first script ends, PHP throws away the uploaded file. If you want to save it somewhere else, then you have to http://php.net/move_uploaded_file -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#105541) next »