put $_FILES into a session

This is a discussion on put $_FILES into a session within the PHP Language forums, part of the PHP Programming Forums category; Hello, I'm trying to get my $_FILES arrays into a session because I want to move the files later ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-30-2004
Tom Rogie
 
Posts: n/a
Default put $_FILES into a session

Hello,

I'm trying to get my $_FILES arrays into a session because I want to
move the files later to a specific directory (ie after I get a result_id
from a sql insert). No problem putting the variables in a session but I
can't move $_SESSION['userfile']['tmp_name'] anymore.
$_SESSION['userfile']['error'] is 0 so I don't really see what could be
the problem....

Anybody can help?

Trogie
Reply With Quote
  #2 (permalink)  
Old 04-30-2004
Kelly Thompson
 
Posts: n/a
Default Re: put $_FILES into a session

On Fri, 30 Apr 2004 02:49:10 GMT
Tom Rogie <Tom@Rogie.be> wrote:

> Hello,
>
> I'm trying to get my $_FILES arrays into a session because I want to
>
> move the files later to a specific directory (ie after I get a
> result_id from a sql insert). No problem putting the variables in a
> session but I can't move $_SESSION['userfile']['tmp_name'] anymore.
> $_SESSION['userfile']['error'] is 0 so I don't really see what could
> be the problem....


I don't really see the problem. After upload, get the name of the
file, move it somewhere safer and after you're ready to delete the
file, delete file saved its name or do whatever you want with it.

if ( move_uploaded_file ( $filename, ´/safe/place') )
$_SESSION['file']='/safe/place'.$filename;

Maybe I didn't understand your question.

Reply With Quote
  #3 (permalink)  
Old 04-30-2004
Jochen Daum
 
Posts: n/a
Default Re: put $_FILES into a session

Hi Tom,

On Fri, 30 Apr 2004 02:49:10 GMT, Tom Rogie <Tom@Rogie.be> wrote:

>Hello,
>
>I'm trying to get my $_FILES arrays into a session because I want to
>move the files later to a specific directory (ie after I get a result_id
>from a sql insert). No problem putting the variables in a session but I
>can't move $_SESSION['userfile']['tmp_name'] anymore.


I fell over that as well, but 'tmp_name' is only TeMPorary for the
request. Next page its gone. You'll either have to copy teh file
somewhere ore really read the file content into a session variable.



>$_SESSION['userfile']['error'] is 0 so I don't really see what could be
>the problem....


If you look on the server, its just gone. I assume because its
temporary.

HTH, Jochen

>
>Anybody can help?
>
>Trogie


--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
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 08:25 AM.


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