Google Fonts and JQuery not working when hosted by Google Drive - hosting

I've uploaded them to a public folder. Everything works apart from these two.
Is there some extra "Google Drive Hosting" script I need to put in?
Or should it be working without any extra and I need re-check my code?
Many thanks!

me also faced same problem while uploading my custom Jquery Plugin, bt i can able upload js file to an existing folder which is already using for my previous project , me faced this problem while creating new folder only
but
In my new folder me just deleted that js file and uploaded it again ,its working fr me nw
save file as .js
content of that file
(function ( $ ) {
$.fn.doValidation = function(options) {
//ur code goes here
}( jQuery ));

Related

How to add sound to Noty notification

I am trying to add a sound to my Noty instance to my Laravel 5.7 app and seem to be running into some issues. The errors I am getting are Uncaught(in promise) DOMException and Get... 404, but I am using the Path intellisense addon in VScode so I am sure it is right. Here is my code:
new Noty({
text:'Example',
type:'info',
timeout:2000
}).on('onShow', function() {
var audio = new Audio('../../../public/sounds/appointed.mp3');
audio.play();
})
.show();
I really appreciate your help
While ../../../public/sounds/appointed.mp3 is correct relative path when you use the editor, it doesn't exist on the server (404 page).
Files that are in the public/ folder should be accessed by using /.
Your mp3 file should be accessed by using /sounds/appointed.mp3 (without public/).
Test it out by trying to load mp3 file http://localhost/sounds/appointed.mp3

File should upload outside the root folder

Im using codeigniter framework,
I have two folders in my public html folder,one contains the main website and other have mobile website
Both having same database
The issue that im facing is,
i want to upload a file from mobile website which should be uploaded in the folder which can be accessible for both sites(mobile and main).
While uploading from mobile site ,it only uploading inside the mobile folder(mobile site)
Some one please tell me how can i upload the file outside the mobile folder(mobile web root),im really struggling in it.
Fileshould upload outside the root folder
Give below is the code i am using
if($_FILES["resumecar"]["name"]){
$file = basename($_FILES['resumecar']['name']);
$ext = end(explode('.', $file));
$ext = strtolower($ext);
$filename = "resume_".time().'.'.$ext;
move_uploaded_file($_FILES["resumecar"]["tmp_name"],"uploads/careers/".$filename);
$uploadfile = "uploads/careers/".$filename;
}else{$filename = '';}

I can not see the image I just uploaded [sails.js]

I have this to upload photos:
module.exports = function (req, image, url, callback) {
var filename = (Math.floor((Math.random() * 100000000000) + 1)) + ".png";
req.file(image).upload({
dirname: '../../assets/images' + url
,
saveAs: function(file, cb) {
cb(null, filename);
}
}, function(error, uploadedFiles) {
return callback(null, "http://" + req.headers.host + "/images" + url + filename)
});
}
And it returns an url like this: http://localhost:1349/images/dependent/photos/30363010266.png
I can see that my photo is uploaded in project folder because I see it physically. But the URL do not work and has appeared not found error.
If I restart server, the URL works fine.
Thanks!
As #Eugene Obrezkov pointed out, your issue is related to where you are uploading your images and the grunt task runner. All the assets are copied from that folder (/assets) to the .tmp, and changes are watched by the grunt task runner, but that doesn't include new image files(If you are to an empty folder in the assets folder, in your case to the image folder). So the solution is quite easy, you must upload directly to the .tmp folder, ideally to .tmp/public/uploads/year/month/, you can choose your path as you see fit. Now there is a caveat with this approach, and it is that there is a grunt task that clears the contents of the .tmp folder on sails lift, so you will get the opposite effect, now to avoid this is quite easy too, you must edit the clean.js task to delete specific folders, to avoid deleting your uploads folder.
Go to to your project folders tasks/config/clean.js, and replace what's in there for this code, or modify it as you need.
module.exports = function(grunt) {
grunt.config.set('clean', {
dev: [
getFolderPath('fonts/**'),
getFolderPath('images/**'),
getFolderPath('images/**'),
getFolderPath('js/**'),
getFolderPath('styles/**'),
getFolderPath('*.*')
],
build: ['www']
});
grunt.loadNpmTasks('grunt-contrib-clean');
};
function getFolderPath(folderName){
return '.tmp/public/' + folderName;
}
Now your uploads will appear immediately to your end-user without restart, and restarts won't delete those uploads. Just make sure the .tmp/public/uploads/ path exist before trying to upload, or use mkdir to create it via code if not found.
There are other solutions, like making sure there is at least a file in the folder you are uploading to when the server starts, or using symlinks, but i think this is a cleaner approach. You can check those options here:
Image not showing immediately after uploading in sails.js
If you take a look into tasks folder, you can find Grunt task that copies all the assets folder to .tmp folder and make .tmp folder as static public folder.
When you are running Sails application, it runs these Grunt tasks, so that if you uploading file direct to assets folder it will not be accessible until you re-run server and Grunt tasks.
Solution? There is no solution. Basically, you are doing it wrong. Best practices is to store images\files\whatever on S3 buckets, Google Storage, another hard drive at least, but not assets itself. Because it's your source files of your project and in there should be located only files needed for project itself, not user's files, etc...
You can achieve without modifing any grunt task. I had the same issue and I have just solved it.
I see you already have an explanation of what's happening in other comments, so I'll go straight to my solution. I uploaded the files to the .tmp folder, and on the callback of the upload, I coppied them to the assets folder using the file system (fs-extra is a great package for that).
So now I can see the images in my UI as soon as it's added (cause I uploaded them to .tmp) and when my server stops, .tmp will be lost, but generated again in the next lift with the files copied to assets.
Hope it helps!
This is how I solved this problem. The answer requires several steps. I am assuming you want to place your recently uploaded images in a folder called users.
Steps:
1. npm install express --save (If you don't have it installed)
Create a Users folder in your apps root directory.
Open the text editor and view the following file config\express.js
Add or replace with the code
`
var express = require('express');
module.exports.http = {
customMiddleware: function (app) {
app.use('/users', express.static(process.cwd() + '/users'));
}
};
`
5. Make certain the newly uploaded images are placed in the Users folder
Finish

How to upload a file in joomla?

Hi i am making a simple component in joomla having name image detail and i have to upload that image how can i upload image from backend. which one is better using extension or make custom. can you please share any good article for it. i have searched many more but due to lack of idea on joomla cannot find. hope you genius guys help me.
thanks i advance
Joomla Component for the exact scenario of your requirement will be very hard to find out. So you've two options:
1. Make your own component
2. Customize other similar type of component like gallery component
For uploading file from joomla component on admin if you're making your own component:
1. Just use move_uploaded_file php function.
2. copy this code, for joomla's standard fxn :
function upload($src, $dest)
{
jimport('joomla.client.helper');
$FTPOptions = JClientHelper::getCredentials('ftp');
$ret = false;
$dest = JPath::clean($dest);
$baseDir = dirname($dest);
if (!file_exists($baseDir)) {
jimport('joomla.filesystem.folder');
JFolder::create($baseDir);
}
if ($FTPOptions['enabled'] == 1) {
jimport('joomla.client.ftp');
$ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']);
$dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $dest), '/');
if (is_uploaded_file($src) && $ftp->store($src, $dest))
{
$ret = true;
unlink($src);
} else {
JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
}
} else {
if (is_writeable($baseDir) && move_uploaded_file($src, $dest)) { // Short circuit to prevent file permission errors
if (JPath::setPermissions($dest)) {
$ret = true;
} else {
JError::raiseWarning(21, JText::_('WARNFS_ERR01'));
}
} else {
JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
}
}
return $ret;
}
If you want to use other's component and edit it according to need, download it:
http://prakashgobhaju.com.np/index.php?option=com_showcase_gallery&view=items&catid=1&Itemid=64
Remember it's a gallery component.
Uploading any file be it an image on your Joomla site is something which is so simple, and can be done using either the web based FTP and or the desktop FTP services like filezilla but only when you have saved the file you want to upload. Using the web based way, you need to log in to your host for example 000webhost, locate the file manager option, click on it and enter your domain username and password. Then go to public_html folder , create a new folder for your photos or images and click on upload. Locate your image and click on the tick link to start uploading.
Using the desktop way, you will need to unzip your file to add to joomla, open your FTP client like filezilla, locate the file on local host, input your log in details as provided by your host and once you are logged in to your account through filezilla, locate where you want to add the file and click on upload.
You can find a similar tutorial with regard here http://www.thekonsulthub.com/how-tos/how-to-upload-joomla-with-filezilla-to-your-hosting-servers-cpanel/ {entire thing}
Please please please make sure you use the filtering available in the MediaHelper. Specifically never trust uploaded images, always check first that they are valid file types, then that they are in the list of approved types of files listed in your global configuration, that the names do not contain html or javascript, and that the files themselves do not contain code. In particular I would recommend the MediaHelper::canUpload method which will check the majority of these things for you. If anything you should be checking even more strongly. Also make sure that you are checking whether the user has permission to upload. If anything you should make the checking even more restrictive. Use the APIs that joomla gives you, such as the built in media field.

Ajax locally testing

I'm new to this Ajax thing. I wanted to try this
http://labs.adobe.com/technologies/spry/samples/data_region/SuggestSample.html
neat little Autosuggest form.
The form doesn't work when i save it locally.
Below there is a list of what i've done and used so far :
Firefox -> save pages as ..(index.html)
new folder ( test23 )
also saved the products.xml
opened index.html
change this line : var dsProducts = new Spry.Data.XMLDataSet("../../demos/products/products.xml", "/products/product", { sortOnLoad: "name" })
into : var dsProducts = new Spry.Data.XMLDataSet("products.xml", "/products/product", { sortOnLoad: "name" })
test failed :(
Can anyone help me out ?
AJAX requests cannot access the local file system, so requests like that will fail. You will need to have the page up on a webserver. If you want a local one, install XAMPP or something similar.
I just tried for like three minutes and got it to work at the first try (without images). you have to remember to get all the scripts and actually point to them in the main html file.
Don't forget the script tags on lines 41 through 43.
Kris
-- additions:
I tested on my Mac's local filesystem without any server using Safari as my browser. I have since deleted the files but could easily do it again and put the files up for download.

Resources