Delphi For PHP Forums    


Go Back   Delphi-PHP Forums > Programming > PHP - Code
Forum Jump Register FAQ Members List Downloads Search Today's Posts Mark Forums Read

PHP - Code PHP programming - Ask questions and help people with PHP code. If you are stuck and need help, this is where you ask for help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 29th December 2009, 13:35
D4PHP User
 
Join Date: May 2008
Posts: 96
ducky is on a distinguished road
Default Open a file

Hi,
I tried to open a file with fopen method but it doesn't work (nothing happens, I don't even get an error)

fopen("myExcelFile.xlsx","r");

Do I miss something?
Thank you ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 29th December 2009, 20:08
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,480
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

$fp = @fopen($logfile,'w+');

fp is a handle and you do everything else with the handle.

fread ( $fp , 30 )
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 30th December 2009, 08:12
D4PHP User
 
Join Date: May 2008
Posts: 96
ducky is on a distinguished road
Default

Hi 405hp, it's been a long time

I tried your code but nothing happens yet. I mean that my intention was to show up the file, after saving it...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 30th December 2009, 12:28
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,480
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

I guess I'm not for sure on what you are wanting.

To dump an excel file to the user and have it open up on his box I use
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=mvog.xls");
echo $xls;

To just create/update a file and store it
$logfile="hits.cnt";
$count = trim(file_get_contents($logfile)) or $count = 0;

/* Increase the count by 1 */
$count = $count + 1;
$fp = @fopen($logfile,'w+');
flock($fp, LOCK_EX);
fputs($fp, $count);
flock($fp, LOCK_UN);
fclose($fp);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 4th January 2010, 10:14
D4PHP User
 
Join Date: May 2008
Posts: 96
ducky is on a distinguished road
Default

Sorry for late reply (and happy new year )

Yes, I wanted to open up a file directly.
I could find an acceptable workaround: I show the link to the generated file in a new popup.

Thanks for your suggestion, anyway
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 05:14.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright © 2004 - 2009, G&J Solutions Ltd. All Rights Reserved. terms of use