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....
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |