Uploadify upload doesn't start - forbidden location? - wordpress

i'm currently trying to implement "UPLOADIFY" to a wordpress template page.
I implemented it well, because almost everything is working now, except the Upload doesn't start, but the reason therefore is propably not wordpress.
It's propably the folder I set where i want to upload the files to.
The folder lies in my root of the page and normally i'm connecting to it with an ftp client. If i call the folder in my browser with http://www.mywebsite.com/fileupload the browser tells me forbidden.
However, that's not the only folder which is not working. it doesn't actually matter which folder i'm creating and what permissions i give it, the upload will not start.
<script type="text/javascript">
$(document).ready(function() {
jQuery('#fileselect').uploadify({
'uploader': '<?php bloginfo('template_url'); ?>/uploadify/uploadify.swf',
'script': '<?php bloginfo('template_url'); ?>/uploadify/uploadify.php',
'folder': 'http://www.mydomain.com/test', //or just /test
'multi' : 'true',
'cancelImg': '<?php bloginfo('template_url'); ?>/uploadify/cancel.png'
});
});
</script>
i tried creating a new directory in my root of my website called "test" and i gave it all permissions 777. However the upload will not start.
do you guys have an idea, what i could do wrong? is there a debug mode or so?
please guys help me, i would love to make uploadify working.

in your $(document).ready function you need to add
'auto': true,
Also I would recommend removing the quote from multi since it is a boolean not a string
<script type="text/javascript">
$(document).ready(function() {
jQuery('#fileselect').uploadify({
'uploader': '<?php bloginfo('template_url'); ?>/uploadify/uploadify.swf',
'script': '<?php bloginfo('template_url'); ?>/uploadify/uploadify.php',
'folder': 'http://www.mydomain.com/test', //or just /test
'multi' : true,
'auto' : true,
'cancelImg': '<?php bloginfo('template_url'); ?>/uploadify/cancel.png'
});
});
</script>

I don't know about this addon, but it seems wrong for me that you set the upload folder in the client side, for obvious security reasons.
I'm sure the plugin have some settings on server side, like an array of available accepted upload locations. Besides, if accessing a folder from your browser says forbidden, it's probably due to that server configuration prevent directory listing, and it doesn't mean it's forbidden for the script to write/upload/create files in it.

Related

Loading static files in Express

I have been trying to get my node.JS file to serve my HTML app with static CSS and JS files included too but have ran into great difficulties (the HTML file is loading, but with no styling). From my searching it seems the main recommended method is to add the Express middleware to your node.JS and then add this line:
app.use(express.static(path.join(__dirname, 'static/')));
Before I go on too much further I will show you my directory set-up:
-static
-images
-favicon
-favicon.png
-logo.png
-style
-design.css
-theme.css
-w3.css
-source
-client
-style.js
-node_modules
-...
-index.html
-root.js
-package-lock.json
-...
The 'root.js' file is my node.JS file that I am running and it serves the 'index.html' page, but all the CSS and JS files my HTML page links to come up with this sort of error...
The stylesheet http://localhost:8080/static/style/design.css was not loaded because its MIME type, "text/html", is not "text/css".
Here is one example of a line in my 'index.html' where I try to link to that CSS file...
<link rel="stylesheet" type="text/css" href="static/style/design.css">
...and here is where 'index.html' is served in my 'root.js' file...
http.createServer(function (req, res) {
fs.readFile('index.html', function (err, data) {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write(data);
return res.end();
});
}).listen(8080);
I am not too sure where I am going wrong as most guides on the topic seem to imply that when I add in the magic '__dirname' line to my node.JS that everything is meant to resolve itself. When I just run my HTML page locally by opening it in Chrome or Firefox it works fine. I am hoping you might be able to explain to me where I am going wrong, thank you.

WSO2 API Manager is saving hundreds of 'publisher' HTML files to directory

WSO2 API Manager is saving hundreds of 'publisher' HTML files (every day) to directory "/root"
All of the files have names like:
publisher.1
publisher.2
publisher.3
...
publisher.978
etc
How do I stop it from creating these files, or atleast how can I change the output directory for the files?
The contents of each file is HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<script>
var requestURL = '/publisher';
var ssoEnabled = 'false';
var tenantDomain = 'null';
</script>
<title>API Publisher- Login</title>
<meta charset="UTF-8">
...
...
...
<script>
var siteRoot = '/publisher/site/themes/wso2';
</script>
<script type="text/javascript" src="/publisher/site/themes/wso2/libs/jquery.cookie.js"></script>
<script type="text/javascript" src="/publisher/site/themes/wso2/templates/utils/button-loader/jquery.buttonLoader.js"></script>
</body>
</html>
Looked in a bunch of config files, and in carbon management settings, but can't find anything that looks like it controls this.
Expect no html files to be saved at all to root directory.
By going through the file content you have given, It seems, it's a rendered output of a publisher page.
Because the following script tag is coming from the base template in WSO2 API Manager publisher app.
<script>
var requestURL = '/publisher';
var ssoEnabled = 'false';
var tenantDomain = 'null';
</script>
But there is no possibility to write the rendered HTML pages to /root/ directory or to anywhere else in the file system.
And also by default (In Unix systems), only root user has Read, Write permission to the /root/ directory. So unless you run a tool with root permission, It can't write files to the /root/ directory.
WSO2 API Manager does not need root permission to run nor it's recommended to start the server with superuser privileges.
So I think, this should have done by some external tool.
For example: If you have configured a health-check tool to GET a /publisher page and write the snapshot of the page to file system each time you perform the health check and if that is configured to write to /root/ directory this could have happened.
Can you check
Whether these files are created in equal time intervals
Who is the owner of these files (ls -lh)
And also check whether WSO2 API Manager is running with the same user who has created those files (ps -aux | grep wso2server).

Polylang language slugs on URL corrupt scripts src

I am using Polylang free to create a multilingual Wordpress website. My scripts are being loaded like this:
<script src="<?php bloginfo( 'url' ); ?>/wp-content/themes/themename/js/scripts.js" type="text/javascript"></script>
Which is true for the default language because Polylang does not change the default url: sitename/post.
When switching to English the url changes, therefore script files are lost, because there is no corresponding locale structure: sitename/en/post.
Console error in inspector (ignore link):
Loading failed for the with source “http://localhost:8888/sitename/en/wp-content/themes/themename/js/scripts.js”.
Help?
Solved
It's not Polylang's fault or anything.
Script src should go like this:
<script src="<?php echo get_template_directory_uri(); ?>/js/scripts.js" type="text/javascript"></script>

How to set Angular2 cli baseurl for a new web site?

I have an existing ASP.NET MVC web site. www.foo.com
I want to create a whole new sub system of our site using Angular2 and I want it to go under www.foo.com/NewSubSystem.
I have downloaded the Angular2 Cli from https://cli.angular.io/.
When I run from the command line
ng build -dev
The output has all the javascript script tags looking this in the index.html file
<script type="text/javascript" src="inline.bundle.js"></script>
<script type="text/javascript" src="styles.bundle.js"></script>
<script type="text/javascript" src="main.bundle.js"></script>
I need the scr="www.foo.com/NewSubSystem/inline.bundle.js"
NOTE: I have tried to update the baseURL in the tsconfig.json
"compilerOptions": {
"baseUrl": "www.foo.com/NewSubSystem"
}
but this does not seem to make any difference.
Any suggestions or pointers would be nice. Thanks
Set the index file baseref
base href="NewSubSystem/"
Then just code like its the root.
I reset the baseref to dist/ with javascript depending on the env sensed
Change your index.js files update
<base href="/<you base url>/">
if you are working with webpack:
You should also update the file config/webpack.common.js, so that you assets folder content can be hosted from your new baseurl.
...
const METADATA = {
title: 'ng2-admin - Angular 2 Admin Template',
description: 'Free Angular 2 and Bootstrap 4 Admin Template',
baseUrl: '/<you base url>/',
isDevServer: helpers.isWebpackDevServer()
};
.....

ASP.NET Client Validation Javascript Partially Rendering

This is happening on my development machine and the same codebase is working in production. So I believe this to be an IIS/Framework issue. It affects all pages.
On both servers, the Page_Validators are setup correctly:
<script type="text/javascript">
<!--
var Page_Validators = new Array(document.getElementById("ValidatorInsurancePayerRequired"),
document.getElementById("ValidatorCheckPostDateRequired"),
document.getElementById("ValidatorCheckPostDateFormat"),
document.getElementById("ValidatorCheckNumberRequired"),
document.getElementById("ValidatorCheckTotalRequired"),
document.getElementById("ValidatorCheckTotalFormat"));
// -->
</script>
However, on my development machine it does not render the script block that sets the validation properties:
<script type="text/javascript">
<!--
var ValidatorInsurancePayerRequired = document.all ? document.all["ValidatorInsurancePayerRequired"] : document.getElementById("ValidatorInsurancePayerRequired");
ValidatorInsurancePayerRequired.controltovalidate = "txtPayer";
ValidatorInsurancePayerRequired.errormessage = "<br>Insurance Payer Is Required";
ValidatorInsurancePayerRequired.display = "Dynamic";
ValidatorInsurancePayerRequired.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
ValidatorInsurancePayerRequired.initialvalue = "";
.
. all other Page Validators
.
// -->
</script>
I have tried running aspnet_regiis -c to reinstall the validation scripts. Failing that I tried that with a -e (remove) followed by -i (install).
Any ideas?
What versions of .NET/IIS are you running? If this is a 2.0 implementation, try putting this in your web.config in the system.web section and see what happens:
<xhtmlConformance mode="Legacy"/>
Does this happen if you run using the ASP.Net Development Server?
Also, if tracing is enabled in development, try disabling it.
Short of these few suggestions, I'd really need a lot more info on your environments in order to assist further.

Resources