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

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.