The framework I am using is Laravel 4.2. I have a .json file stored in my /app/database/seeds/json folder, intentionally to stop people from accessing it in my public directory (it's information that I've paid for, and so I don't want people accessing it).
I am trying to access this in a 'typeahead` style feature, but it can never find the file. Currently, the script is:
var location = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: '/app/database/seeds/json/file.json'
});
But in Google inspect, it returns the error:
http://localhost:8888/app/database/seeds/json/file.json 404 (Not Found).
Is there a way of even accessing this file? Or can I use my public file and yet still have some protection on people accessing it?
Any help would be hugely appreciated.
Anything which needs to be publicly accessible, but which comes as part of a package, needs to be published.
Perhaps something like this would get it working:
php artisan asset:publish --path="app/database/seeds/json/file.json" bloodhound/json/file.json
If that worked, the file would be accessible from the URL /packages/bloodhound/json/file.json
Related
When creating a new database through PHPMyAdmin and trying to access localhost/newdatabase, I get this message:
"Object not found! The requested URL was not found on this server. If
you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404 localhost Apache/2.4.34 (Win32) OpenSSL/1.1.0i PHP/7.2.9"
The file doesn't show in xampp/htdocs either, only in xampp/mysql/data.
If i create files directly in htdocs, they work perfectly on localhost/.
Why has the file not been created in htdocs?
The content of the htdocs folder are files that can be interpreted by the browser such as HTML5, CSS, JS, etc... in order to show a webpage along with it's funcionality to whoever accesses it. A database in the other hand can't directly be opened by a browser, but rather accessed within the server by a backend language like PHP, in order to get the information that can be stored in it through tables. You seem to be new to web programming, so I'd recommend to quickly google some beginner tutorials that can help you to understand the most important concepts. To take on from your kind of confusion, I'd point you to expand your knowledge on these concepts:
HTML5
CSS
PHP
MySQL
Once you get the grasp of them and identify each by their core funcionality, you'll be good on your way to make webpages. Later on you'll find yourself with demands like making your webpage look nice and clear, and also to make it load fast, but there's time for everything and the concepts I pointed are the best start for you.
if you wanna open your database URL = http://localhost/phpmyadmin/
File directory ~ xampp/htdocs for source code such as extension file .php .html .js or other.
if you wanna load localhost a URL is http://localhost:80 (auto find index file to first load)
Sample given as image folder for my code. Hope that can help you to understand xampp
I want in Yii2 a simple
[a href="C:/Vo/AGO/2015.pdf">2015 [/a> ([ must be a <)
on one of my forms.
I don't want to upload the file, because the pdf (help) file is updated by an external organisation (instead of C: the pad is a server, but for test reasons I use C:), and I have to display a lot of files managed by that organisation.
So I use:
Html::a("2015", "C:/Vo/Ago/2015.pdf")
When I run the application and I inspect via show source I see
[a href="C:/Vo/Ago/2015.pdf">2015[/a>
But if I click the link on my form, nothing happens!
(When I do the same thing in a simple html document - not yii2 - the pdf opens)
If I copy right-click and copy the link I get:
file:///C:/Vo/Ago/2015.pdf
So, what am I missing?
Yes I'am new in Yii2 and I searched a lot on internet to find a solution.
If this is already asked, excuse me, a reference to the solution would then be welcome...
Thanks,
Chris G.M. Logghe
Because you are trying to link "local" file on browser.
Some browsers, like modern versions of Chrome, will even refuse to
cross from the http protocol to the file protocol, so you'd better
make sure you open this locally using the file protocol if you want to
do this stuff at all.
See here for more details.
The best option for you is to create action on controller and perform download file there.
In your view:
$data = 'C:/data/mydata.log';
echo Html::a('Download', ['sample-download', 'filename' => $data], ['target' => '_blank']);
In your controller:
public function actionSampleDownload($filename)
{
ob_clean();
\Yii::$app->response->sendFile($filename)->send();
}
Of course, you must limit to specific directory rather than user give full access to filename.
I am working on an application where a user can create a list, and share it publicly. The contents of the list is rendered by my site as a webpage, but exists also as a text file in the users drive who created it. Everything is handed by javascript, and works well, however I am currently using the https://www.googleapis.com/auth/drive scope.
This is a very scary permission to have, so I would like to drop it. However, when the user trying to read the file, if they only have the https://www.googleapis.com/auth/drive.file scope, the shared file (accessed by id) doesn't exist for them until I run them though the sharing flow.
My guess is that although this was a file created in my application, that file was never opened by the viewing user in my application, so it doesn't qualify under that scope. This seems a bit silly, because anyone (even if they are not logged in as any user) could download the file from google using only its id.
I want to avoid running them through the share-link flow, because if the user hasn't logged into my application yet, they are more or less stranded at that screen. The app isnt installed as a viewer for that filetype for them, so they aren't presented with it as a suggested app to use to open it.
Am I doing something wrong, or is there really no way to support this seemingly very common use case of enabling a user to share links to their files though the app open url?
I dont see why I should need full access to the user's drive as I'm trying to access a file that isn't even in their drive.
Note: I do also have the realtime-api mounted on top of the file, which is also working, but shoudln't really have anything to do with the basic sharing.
Some relevant code snippets creating and setting permissions on the file:
Create The File
gapi.client.load('drive', 'v2', function() {
var insertHash = {
'resource': {
mimeType: 'application/vnd.mysite.com',
title: title
};
};
gapi.client.drive.files.insert(insertHash).execute(next);
});
Grant Everyone Permissions
gapi.client.drive.permissions.insert({
fileId: $scope.id, resource: {
type: 'anyone',
role: 'writer'
}
}).execute(function(resp) {
console.log(resp);
});
Try to access the file as a viewer, fails with out https://www.googleapis.com/auth/drive scope
gapi.client.drive.files.get({fileId: $scope.id}).execute(function(resp) {
console.log(resp);
next(resp);
});
hi i'm creating an app using webdav server.Here i'm getting the response from webdav server and i'm binding it to listbox on clicking on that listbox items each and every item having path in webdav. If i went from main root path to particular folder from there if i click on backkey press event app closing and coming out.I want on backkey press root folder should come which should come from subfolder
Please if anyone knew this help me.I knew how to ovveride but it is closing the app.
Please if anyone help highly appreciable.
protected override void OnBackKeyPress(CancelEventArgs e)
{
startRequest();// it is the method which i can retrieve the file structure.
}
First of all, I suppose you're building a native WP8 app using Silverlight. There're many totally different ways to build apps for WP8 but you haven't specified your platform. If you're using something different ( JS Web / C# Store / C# Xamarin / JS phonegap / C++ XAML / etc ) my answer is irrelevant.
See this answer for one way to handle the hardware back key.
In the handler, you need to check whether the currently displayed folder is the root or not.
If it’s the root or empty, you do nothing just return, let the system handle the event, which will close your app.
If your listbox is showing some non-root folder, you set e.Cancel = true; and show the content of the root WebDAV folder in your listbox. This way the system doesn't handle the back button event so the app doesn't close, but you do handle so you're showing the root folder in your list.
I am having trouble using dartdocgen and dartdoc-viewer to pump my JSON files to the browser. I have had success getting all the JSON files from my application but haven't had any success actually viewing them in the browser. Based on my research, the best way to do this is hosting dartdoc-viewer on a local server as mentioned by this document:
https://www.dartlang.org/tools/dartdocgen/#deploy
However I just cannot seem to get it to work following these directions (I would like to approach it via dartium):
https://github.com/dart-lang/dartdoc-viewer/
I understand that once I am able to run pub build and compile to javascript that I dump the client/build folder into my server along with the docs folder under the URL, I am golden. That's where the issue is, how to get it from the docs folder to javascript to the browser.
I would like to be able to use dartdocgen to it's full potential so can I get some ideas?
Just run dartdocgen --serve .
see https://www.dartlang.org/tools/dartdocgen/#view-locally
Is not what you are looking for?