Jump to content

php syntax question


flashwiz

Recommended Posts

Hi guys,

 

I have this script I am using to save images to a server, the code is being triggered by a flash app.

 

I would like to be able to send a variable via query string from flash and have php use it for the directory name. 

 

Here is my current script...thanx for the help:

<?php
// if directory doesn't exist make it
if(!is_dir("./files")) mkdir("./files", 0755); 
$moveToDir = 'files/';
foreach ($_FILES as $fieldName => $file) {
$uploadFileName = $file['name'];
move_uploaded_file($file['tmp_name'], $moveToDir.$uploadFileName);
chmod("./files/".$file['tmp_name'], 0777);
}
?>

 

and this is what I am sending:

 

"multi.php?folder=someValue"

 

Link to comment
https://forums.phpfreaks.com/topic/165299-php-syntax-question/
Share on other sites

Try this:

 

<?php

// Folder specified in url
$folder = $_GET['folder']; // place this folder wherever you need it in the script, but this is how you reference it.

// if directory doesn't exist make it
if(!is_dir("./files")) mkdir("./files", 0755); 
$moveToDir = 'files/';
foreach ($_FILES as $fieldName => $file) {
$uploadFileName = $file['name'];
move_uploaded_file($file['tmp_name'], $moveToDir.$uploadFileName);
chmod("./files/".$file['tmp_name'], 0777);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/165299-php-syntax-question/#findComment-871740
Share on other sites

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.