TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-12-2008, 08:57 AM   #1 (permalink)
The Contributor
Good Samaritan 
 
d4v1d's Avatar
 
Join Date: Dec 2007
Location: Durban, South Africa
Posts: 51
Thanks: 1
d4v1d is on a distinguished road
Default HELP! File Upload

I'm about to rip all my hair out on this... Been struggling with it since last night, and still can't figure it out. Basically, doing a file upload through flash, which then calls a php file to handle moving it from the temp directory. Here's the basic code that handles that little bit:

PHP Code:
$uploadFile "/games/" $_SESSION['filename'] . '.swf';

if (
move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploadFile)) {

Now here's my problem, it doesn't work. The filename variable is set from mktime() on a previous page. I have echoed it to this new page to check, and it is definitely set. And I have definitely called the session start function. All that works perfectly, yet no file on the server...

When i set a name manually, however, it works. Thus I don't understand why. It should work the way it is, shouldn't it?
d4v1d is offline  
Reply With Quote
Old 09-12-2008, 09:15 AM   #2 (permalink)
The Contributor
Good Samaritan 
 
d4v1d's Avatar
 
Join Date: Dec 2007
Location: Durban, South Africa
Posts: 51
Thanks: 1
d4v1d is on a distinguished road
Default

I think the problem lies with the flash... As when I call the file directly it returns the filename perfectly, yet when I run it through the flash, it returns an empty value. Do session variables work with a php page initiated from flash?

Edit: Am going to append the PHPSESSID to the end of the page request in flash, see if it helps
d4v1d is offline  
Reply With Quote
Old 09-12-2008, 06:52 PM   #3 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

d4v1d: check for a reinitialization event that occurs when the file has been uploaded. You might want to check that the phase of calling the php file is not called on the event complete handler of the FileReference handle.

As for passing the PHPSESSID through a GET variable, then that is the way to go. I've tried myself a couple of ways some while ago, but nothing else worked.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 12:29 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design