473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Problem with my SESSION

4
Hey guys, i've been working on this for a few hours, so I think it is time I need som fresh eyes. I'm trying to store some variables with by using SESSION. I know it is being stored and that I can retrieve their values from other pages, but I can't from the one. Can somebody maybe just have a quick look at my code snippet and tell me if I'm missing something?

Expand|Select|Wrap|Line Numbers
  1. session_start();
  2. $cat = $_SESSION['cat'];
  3. $subcat = $_SESSION['subcat'];
  4.  
  5. $filename    = $_FILES['Filedata']['name'];
  6.     $temp_name    = $_FILES['Filedata']['tmp_name'];
  7.     $error        = $_FILES['Filedata']['error'];
  8.     $size        = $_FILES['Filedata']['size'];
  9.     $randomName = genRandomString();
  10.     $ext = explode(".", $filename);
  11.  
  12.     /* NOTE: Some server setups might need you to use an absolute path to your "dropbox" folder
  13.     (as opposed to the relative one I've used below).  Check your server configuration to get
  14.     the absolute path to your web directory*/
  15.     if(!$error) {
  16.         copy($temp_name, '../dropbox/'."blah".$randomName.".".$ext[count($ext)-1].$subcat);
  17.     }
  18.  
Jul 17 '10 #1
2 1355
Atli
5,058 Expert 4TB
What happens if you var_dump the session variables? Does it show the correct data?

And why are you attaching the $subcat value onto the file extension of the new file?

P.S.
You shouldn't use copy() to move uploaded files. You should use move_uploaded_file. Safer that way.
Jul 18 '10 #2
htdIO
4
@Atli
Thanks for the reply. When I var_dump I get nothing.

Thats my bad, I forgot I put it there. It was just another way of testing if the variable has been set.

Lastly, thanks for the advice, will do that. I have decided to rewrite my whole script now. I missed a few important things that will be too hard to add in now.
Jul 18 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Pavel Vetesnik | last post by:
Greetings! I have some troubles with session variables. I can easily create a session, but the variable I append to global session array ( $_SESSION) lasts only until the end of current...
3
by: Craig Storey | last post by:
I have a form where users logged in using sessions can edit articles in a WYSIWYG editor. Some of them take their time and don't like to save their work very often and occassionally the sessions...
9
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example...
1
by: Werner | last post by:
Hi Patrick! Can you give an example of how to use a frameset inside an aspx-file? When I create a new frameset in Visual Studio.Net it just gives me a htm-File. Or give me a link where I can...
10
by: Tamir Khason | last post by:
Following the problem: Session data for ASP.NET Web applications appears to be lost at random intervals for the InProc session state mode. We can not freely debug an application or install any 3rd...
0
by: Bernie | last post by:
Hi All, I have a weird problem with using flash on aspx pages. It goes like this: I have some links with query string parameters in the page. The same links appear as regular "a href" and also...
3
by: ywz | last post by:
Hi All, I built a web application using cookieless session. It merely checks for the session variable value upon login. This method works fine on the host pc. However, when i try to access...
2
by: Tom | last post by:
I hope someone can help me figure out what's going on here. I've re-read the section on sessions at php.net and Googled this high and low but I haven't found anything that quite explains my...
26
by: BillE | last post by:
Some ASP.NET applications use Session Variables extensively to maintain state. These should be re-written to use viewstate, hidden fields, querystring, etc. instead. This is because if a user...
1
by: gnewsgroup | last post by:
I am using forms authentication for a web application. Like many other member web application, my web application prints out Welcome! John Doe (Logout) on the top right corner of each...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.