Bluehost.com Web Hosting $6.95

$x = fopen ressource as as get parameter.

This is a discussion on $x = fopen ressource as as get parameter. within the PHP Language forums, part of the PHP Programming Forums category; Hi all, I'm trying to pass a fopen() ressource result as a parameter. $x=fopen($filename); header('location:myfile....


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-06-2006
Bob Bedford
 
Posts: n/a
Default $x = fopen ressource as as get parameter.

Hi all,

I'm trying to pass a fopen() ressource result as a parameter.

$x=fopen($filename);
header('location:myfile.php?ressource='.$x);

but it doesn't seem to work.

How to do so ?

Bob



Reply With Quote
  #2 (permalink)  
Old 10-06-2006
Erwin Moller
 
Posts: n/a
Default Re: $x = fopen ressource as as get parameter.

Bob Bedford wrote:

> Hi all,
>
> I'm trying to pass a fopen() ressource result as a parameter.
>
> $x=fopen($filename);
> header('location:myfile.php?ressource='.$x);
>
> but it doesn't seem to work.
>
> How to do so ?
>
> Bob



Hi Bob, you don't.
A resource is something you can create for the duration of your script, so
when your script finishes, it is gone.

In your case I would pass the filename, and let the receiving script make
its own resource based on the filename.

Regards,
Erwin Moller
Reply With Quote
  #3 (permalink)  
Old 10-06-2006
chonny
 
Posts: n/a
Default Re: $x = fopen ressource as as get parameter.

fopen is function that open files.
see this: http://php.net/manual/en/function.fopen.php


Bob Bedford написа:
> Hi all,
>
> I'm trying to pass a fopen() ressource result as a parameter.
>
> $x=fopen($filename);
> header('location:myfile.php?ressource='.$x);
>
> but it doesn't seem to work.
>
> How to do so ?
>
> Bob


Reply With Quote
  #4 (permalink)  
Old 10-06-2006
Pedro Graca
 
Posts: n/a
Default Re: $x = fopen ressource as as get parameter.

Bob Bedford wrote:
> I'm trying to pass a fopen() ressource result as a parameter.
>
> $x=fopen($filename);
> header('location:myfile.php?ressource='.$x);
>
> but it doesn't seem to work.


When the script ends (after the header() call) the file gets closed and
the resource terminated. There is no way to pass a resource (any
resource, not just a open file handle) to other scripts; you can't do it
with URL parameters nor with POSTed data nor with cookies nor with
session variables.

> How to do so ?


Pass the name of the file and reopen it.

header('Location: http://www.yourserver.com/path/to/myfile.php?filename=' . urlencode($filename));
exit(0);


myfile.php
// validate $_GET['filename']
$f = fopen($_GET['filename']);

--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot
Reply With Quote
  #5 (permalink)  
Old 10-06-2006
Bob Bedford
 
Posts: n/a
Default Re: $x = fopen ressource as as get parameter.

Thanks for your help....didn't find out so I guessed it wasn't possible

Bob



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:30 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0