Link to home
Start Free TrialLog in
Avatar of bilgehanyildirim
bilgehanyildirim

asked on

php fputs iis 6.0

Hi there,

When I run the following code on linux/apache server, it correctly creates the file. But when I run it on Windows 2003 IIS 6.0, it still creates the file but they are not valid picture files.

Is there something else I need to do to be able to run this on IIS ?

PS : $campaign['Campaign']['picture'] is a BLOB field in mysql database.
$absDir = WWW_ROOT . 'img' . DS . 'campaign' . DS;
			$filename = $absDir.$id'.jpg';
			$fp = fopen($filename,"w+");
			fputs($fp, $campaign['Campaign']['picture']);
			fclose($fp);

Open in new window

Avatar of asafadis
asafadis
Flag of United States of America image

Any error messages?
Is the "$absDir" variable pointing to the right location?  Moving from Linux to Windows will also change your path structure.
Avatar of bilgehanyildirim
bilgehanyildirim

ASKER

No no error. Site is creating the file in the correct location. But when I double click on it, it says (on windows) no preview available.
ASKER CERTIFIED SOLUTION
Avatar of asafadis
asafadis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Still same, no preview available
actually the file created on linux/apache is 13.6 KB, but the file create on IIS is 8.1 KB. Even though I made the changes you mentioned above.

I am attaching the file that doesn't work
63.jpg
It has nothing to the with PHP or IIS, it was mysql error.

Thanks for the tip though.