It looks like you're new here. If you want to get involved, click one of these buttons!
RewriteRule !\.(js|ico|gif|jpg|png|css|txt|swf)$ index.php
$(document).ready(function() {
$(\"#photo\").uploadify({
'uploader' : '<?php echo $this->baseUrl('/flash-uploader/scripts/uploadify.swf') ?>',
'script' : 'my-account/flash-upload',
'cancelImg' : '/flash-uploader/cancel.png',
'folder' : 'uploads/tmp',
'queueID' : 'fileQueue',
'auto' : true,
'multi' : true,
'sizeLimit' : 2097152
});
});
'script' : 'my-account/flash-upload',
'script' : '/my-account/flash-upload',
'script' : 'http://mywebsite.com/my-account/flash-upload',
'script' : 'myaccount/flashupload',
controller: MyaccountController
action: flashuploadAction
MyAccountController
my-account
risoknop said:Thanks for help. I managed to solve the issue by playing with the order of tags in the head section. Now the 'browse' button appears but I have another problem.
It seems like there is a problem with this line:'script' : 'my-account/flash-upload',
Because I get a progressbar and it says upload completed but the code in the flash-upload action in the my-account controller doesn't get executed. I tried also:'script' : '/my-account/flash-upload',
And also absolute path:'script' : 'http://mywebsite.com/my-account/flash-upload',
None of them works
'script' : '<?php echo $this->url(array('controller' => 'upload', 'action' => 'handle-file-upload')) ?>',
public function handleFileUploadAction()
{
$this->disableAutoRendering();
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $this->_getFileUploadPathForUser($_POST['userID']) . '/'; // app specific function
$targetFile = str_replace('//', '/', $targetPath) . $_FILES['Filedata']['name'];
// If the target directory isn't available, create it
if (!is_dir($targetPath)) {
mkdir($targetPath, 02775, true);
}
move_uploaded_file($tempFile, $targetFile);
switch ($_FILES['Filedata']['error'])
{
case 0:
$msg = \"No Error\"; // comment this out if you don't want a message to appear on success.
break;
case 1:
$msg = \"The file is bigger than this PHP installation allows\";
break;
case 2:
$msg = \"The file is bigger than this form allows\";
break;
case 3:
$msg = \"Only part of the file was uploaded\";
break;
case 4:
$msg = \"No file was uploaded\";
break;
case 6:
$msg = \"Missing a temporary folder\";
break;
case 7:
$msg = \"Failed to write file to disk\";
break;
case 8:
$msg = \"File upload stopped by extension\";
break;
default:
$msg = \"unknown error \".$_FILES['Filedata']['error'];
break;
}
if ($msg) {
$stringData = \"Error: \".$_FILES['Filedata']['error'].\" Error Info: \".$msg;
} else {
$stringData = \"1\"; // This is required for onComplete to fire on Mac OSX
}
echo $stringData;
}
}
onComplete(event, queueID, fileObj, response, data) {
alert('Response: ' + response);
}