Cannot access files within subdomains or folders - http-status-code-404

I created a sub domain named test on http://www.t2transfer.com/ and I put a index file. When I go to http://www.t2transfer.com/test/ url It shows a 404 page and blue host webpage. I also tried by creating a folder names test. But It also shows same result. Why is that? Please guide me to solve this.

You are accessing a folder path, a sub-domain would look like http://test.t2transfer.com/

Related

How to show Image from local drive in Angular JS [duplicate]

I'm trying to retrieve a picture from my file system after a good storage,(instead of putting it in the database I copy it to the disc and i put the path to the db)
I had store the picture to c:\images\ folder and supposing that the name the complete path is c:\images\mypic.jpg
when I try to retrieve it a set the img src attribute to <img src="c:\images\mypic.jps"> by using some java code
in the browser console I found this error Not allowed to load local resource: file:///C://images//mypic.jpg
Question: how to fix these path problem ? where Should I store the pictures ? and from where should I retrieve them ?
sending tag <img src="c:\images\mypic.jpg"> would cause user browser to access image from his filesystem.
if you have to store images in folder located in c:\images i would suggest to create an servlet like images.jsp, that as a parameter takes name of a file, then sets servlet response content to an image/jpg and then loads bytes of image from server location and put it to a response.
But what you use to create your application? is it pure servlet? Spring? JSF?
Here you can find some info about, how to do it.
In Chrome, you are supposed to be able to allow this capability with a runtime flag --allow-file-access-from-files
However, it looks like there is a problem with current versions of Chrome (37, 38) where this doesn't work unless you also pass the runtime flag --disable-web-security
That's an unacceptable solution, except perhaps as a short-term workaround, but it has been identified as an issue:
https://code.google.com/p/chromium/issues/detail?id=379206
You have Two alternatives :
First one is to create a ServletImageLoader that would take as a parameter an identifier of your image (the path of the image or a hash) that you will use inside the Servlet to handle your image, and it will print to the response stream the loaded image from the server.
Second one is to create a folder inside your application's ROOT folder and just save the relative path to your images.
Many browsers have changed their security policies to no longer allow reading data directly from file shares or even local resources. You need to either place the files somewhere that your tomcat instance can serve them up and put a "regular" http url in the html you generate. This can be accomplished by either providing a servlet which reads and provides the file putting the file into a directory where tomcat will serve it up as "static" content.
The concept of http location and disk location is different. What you need to do is:
for uploaded file summer.jpg
move that under a known (to the application) location to disk, e.g c:\images\summer.jpg
insert into db record representing the image with text summer.jpg
to display it use plain <img src="images/summer.jpg" />
you need something (e.g apache) that will serve c:\images\ under your application's /images. If you cannot do this then in step #2 you need to save somewhere under your web root, e.g c:\my-applications\demo-app\build\images
This error means you can not directly load data from file system because there are security issues behind this. The only solution that I know is create a web service to serve load files.
Here is a simple expressjs solution if you just want to run this app locally and security is not a concern:
On your server.js or app.js file, add the following:
app.use('/local-files', express.static('/'));
That will serve your ENTIRE root directory under /local-files. Needless to say this is a really bad idea if you're planning to deploy this app anywhere other than your local machine.
Now, you can simply do:
<img src="/local-files/images/mypic.jps"/>
note: I'm running macOS. If you're using Windows you may have to search and remove 'C:\' from the path string
Do not use ABSOLUTE PATH to refer to the name of the image for example: C:/xamp/www/Archivos/images/templatemo_image_02_opt_20160401-1244.jpg. You must use the reference to its location within webserver. For example using ../../Archivos/images/templatemo_image_02_opt_20160401-1244.jpg depending on where your process is running.

Downloading files from URL

I have a question related to a security on website. Lets say that a visitor is currently on a http://www.example.com/. And visitor navigates to gallery page. There he can find unique images that are displayed to him according to his log in details he provided earlier. A simple inspect on a picture shows him the URL to that picture: www.example.com/images/image_589326.png.
My question is: Is there a way for a user to somehow download all the files from
www.example.com/images/ folder, or somehow find the names of all images that are in that folder and simply view them with absolute URL.
Yes, that is possible. There are two main ways that this can be achieved: scraping & enumeration.
Through scraping someone would make a script that would look at the gallery page and make a list of all of the images, and then download them all.
Enumeration would just request http://www.example.com/images/image_000001.png through http://www.example.com/images/image_999999.png and download of the images that are present.
If the site is not proprely set up you may also be able to get a directory listing from http://www.example.com/images to see all of the files in the images/ directory.

Not able to save settings in phpList admin panel

I am integrating phpList into my website. I initialized database.
I was able to integrate my website with phpList.
In admin panel whenever i try to do anything like delete member from subscriber list or change any setting for subscriber page. I am getting this error "The requested URL /index.php was not found on this server."
I know that this is the problem of path.
When user receives email it says to confirm click on this.
http://admin.ridesharebuddy.com/lists/?p=preferences&uid=TOKEN
When user clicks on this, it displays error page not found.
Because path should be something like this.
http://admin.ridesharebuddy.com/rideshare/lists/?p=preferences&uid=TOKEN
How can i change this path ?
So from what I see, you have 2 issues:
Firstly:
index.php is not being found.
This is generally because of a) an upload error, or b) missing directory traversals within the script (../../ etc..)
What we need to know is why index.php is not found, and why it is being called when you try to make a change
Secondly:
The link generated when the email is sent, is incorrect. This will just be a case of finding where the link is generated, and modifying it to generate a correct code.
If you could update the post with source for the files, then I may be able to help you further.
If you feel you can't do the above, then I suggest using a different, more mature (and better coded), mailing script for your site.

Placing and accessing images outside app/webroot at Cakephp

I am currently saving uploaded images at /cakephp/uploads/ instead of doing it inside /cakephp/app/webroot/imgs/.
When i try to access the image by URL, with something like this:
http://myweb.com/cakephp/uploads/imageName.jpg
It shows a 404 error. I guess, due to the .htaccess, or more concretely, to the web.config file that i use under windows with ISS7.
Is there any way to access to them without modifying the web.config file?
Thanks.
it is my understanding that anything not placed in the webroot folder cannot be accessed directly via a url. To access files outside of the webroot, you can use Media Views.
I'd just put your uploads folder inside your APP folder, http://myweb.com/cakephp/app/uploads
then just adjust path to path => APP . 'uploads' . DS
It's not clear why you want to do this; if you want to just access the images like normal, place the uploads in to your img directory.
Typically you'd use this approach for serving files etc, allowing user authentication and so on.

cakephp path is pointing to the wrong folder

I have a site in cakephp,the issue I am having is the images and css files are pointing to bedutech.com/
while cakephp structure the images are in the img folder that is located in : app/webroot/img
same goes for the css file so I cant see the site layout properly.
any suggestions ?
You first need to find out where the bedutech.com is pointing to and whether it's pointing to the server that has your Cakephp site stored. If so, Cakephp has a routing structure so that anything under webroot folder is accessible as a root in URL. This means you can type bedutech.com/img or bedutech.com/css to access webroot/img and webroot/css folders.
If you have trouble finding out whether bedutech.com is actually pointing to your Cakephp server, you can either check DNS records by going to who.is/bedutech.com or actually test it out by typing in the URL in your browser.

Resources