Jump to content

SWFupload (help with PHP part of the upload)


gordon.c

Recommended Posts

Hi

 

I am using SWFupload plugin and I need the upload directory to change dynamically.

 

The php code for this plugin is

 

<?php
$uploaddir = "./uploads/";
$file = $uploaddir . basename($_FILES['uploadfile']['name']); 
$size=$_FILES['uploadfile']['size'];
/* ... */
?>

 

What I need is to put into the first line something similar to

 

$uploaddir = "./uploads/".$_REQUEST['current_selected_directory'];

 

so that files will be uploaded to current directory or directory I choose at the moment.

 

I tried to use $_REQUEST[] variables which apparently can not be read by the script, I also tried $_SESSION and even $_COOKIE. None of these variables is being read by the script.

 

Do you have any way how to solve this?

 

Thank you

Files handled by PHP are all temporarily uploaded the the upload_tmp_dir (PHP.ini setting), its the programmers' job to move them to a location of their choosing.  As it turns out there's a handy function for moving uploaded files around named move_uploaded_file.  Also, for future reference files are uploaded to a server via a HTTP POST method in most circumstances. 

move_uploaded_file( $_FILES["uploadfile"]["tmp_name"], $CustomPath . $filename);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.