views:

96

answers:

0

I am trying to use uploadify and an FTP connection to upload a file. I realized the directories weren't being created because the 'folder' var from the js is not getting passed. I am wondering if this is a scope thing. Anyway, here is the js:

$("#uploadify").uploadify({
'uploader'       : '/lib/jquery.uploadify-v2.1.0/uploadify.swf',
'script'         : '/lib/jquery.uploadify-v2.1.0/uploadify.php',
'cancelImg'      : '/lib/jquery.uploadify-v2.1.0/example/cancel.png',
'folder'         : '<?=time()?>',
'queueID'        : 'fileQueue',
'multi'          : true

});

PHP:

$dir = $_REQUEST['folder'];
if (!ftp_mkdir($conn_id, $dir)) {
 echo "There was a problem while creating $dir\n";
} else {
echo "successfully created $dir\n";
}

I get an error-- "ftp_mkdir(): Unable to create the directory."

I did check to see if the time() was getting echoed out and it is. If I hardcode a plain string there it fails. But if I change the $dir to equal "whatever" (rather than request) the directory will get created, but it will not take the request param. I tried get and post as well.

Also this same scenario does work if I am not using FTP, just upload to server the page is being served from – no problems.