473,803 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 17 '05 #1
2 4383
On Fri, 30 Apr 2004 02:49:10 GMT
Tom Rogie <To*@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_f ile ( $filename, ´/safe/place') )
$_SESSION['file']='/safe/place'.$filenam e;

Maybe I didn't understand your question.

Jul 17 '05 #2
Hi Tom,

On Fri, 30 Apr 2004 02:49:10 GMT, Tom Rogie <To*@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/
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1788
by: Eric Haskins | last post by:
Ok I am trying to get these loops figured out I have 10 files being uploaded- $_FILES I need to run str_replace on all 10 to eliminate any oddities " ","%20" to clean up the filenames before inserting names in db. foreach ($_FILES as $n) { $name=$n str_replace( " ", "",$name)
0
7727
by: mrbog | last post by:
All I did was recompile my PHP 4.3.4 with the included GD and now my $_FILES is perpetually empty. My php app is identical, I haven't changed it at all since recompiling. I tried recompiling again without GD to fix the problem, to go back to what I had before, but $_FILES is always empty. I can't imagine that I'm doing something so out of the ordinary, and yet I'm unable to google for someone with the same problem. I am running...
1
2639
by: Bob Bedford | last post by:
I've a function asking for a $_FILES argument: function insertarticle($particle,......,$pUserID,$pOptions,$files){ in this function I do add the record and then save the files in a subdirectory specific on some datas. This function is used by my "insert" form, letting the user to select images files to upload with <FILE> html tag. The files to upload are then passed to the $files like this:...
6
2510
by: Shelly | last post by:
I have searched and have not gotten an understanding of $_FILES. I am trying to do an upload to a directory "tmpdir" on the server. I have a field defined as: File name: <input name="filename" type="file" id="filename"> In my PHP code I have (with diagnostics): echo "Will try to upload a file <br>"; echo "Tmp_Name: ".$_FILES."<br>";
3
5641
by: Iced Milk Tea | last post by:
I am trying to program a upload system. The following code work very fine, $file_name = $_FILES; $size = filesize($file_name); $type = mime_content_type($file_name); However, when I change to
8
3491
by: mpar612 | last post by:
Hello, I am a newbie to PHP, MySQL. I am trying to create a basic file upload form. I want to get that working and then I want to integrate that into a form that will rename the file and save it to a directory and store the path to the file in the db, in addition to storing other text from other fields in the form. Then I will get that path using PHP to display the image file in a browser. First things first, I'm having difficulty...
3
2249
by: skulkrinbait | last post by:
I've a HTML form that allows a user to specify the location to upload a file from: <p><label for = 'file'>Upload Graphics : <input type='file' name='imagefile' /></label></p> I then want to check if the user entered something or not as this isn't mandatory. Here's an excerpt of the relavent code: if (isset($_POST))
5
2583
by: Karl | last post by:
Hello again. I have a form for posting news articles. Form one is the "register" form. Then I go to the preview form were I can select edit or accept If I select edit, I got the "edit form" and if I select accept, I receive a message that say: The news article "headline" are posted into the database.
3
9387
Markus
by: Markus | last post by:
Ok, so i'm doing the multiple file upload thingymabob! I'm just playing around really... When i try to check the file type i simply get Array(). foreach ($_FILES as $_key => $_value) { echo $_value . " was uploaded successfully.<br />";
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9565
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10550
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2972
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.