Can't find file uploaded - ruby-on-rails-3

I am trying to create a directory where I can store files to download/link to...for example, I have a CSV file with data I need to use on another site.
I created a folder in app/assets/ named files/site1content. If I go to http://mysite.com/assets/files/site1content/filename.txt, I get a "could not find mysite.com".
Does something need to be configured in the routes?

The public folder is aimed for public access, put your files in public/files/site1content folder.

Related

Browser cannot download .txt file if the project is .Net Core Restful API

I am trying to activate my SSL for my project but one of the the urls doesn't respond.
This is the web site and when you paste the url to the browser, it downloads the .txt file.
http://www.xxx.co.uk/.well-known/pki-validation/83CB00D29E282E1FFD6DFB220F030EF4.txt
This is the Restful .Net Core API domain and when you paste the url to the browser, it returns 404 error.
http://api.xxx.co.uk/.well-known/pki-validation/83CB00D29E282E1FFD6DFB220F030EF4.txt
Under the IIS I have compared the psychical paths, permissions and it seems everything is same. I believe something in Rest API blocks the .txt file download. Should I check the web.config or something I need to add to the C# source code? Should I update ConfigureServices(IServiceCollection services)? In IIS I have checked MIME Types and the .txt is already defined.
Any suggestions?
I believe my problem is pointing to this subject but I am not sure how to enable/define .txt files in startup.cs. Any code snippets?
How to Serve Static File
EDIT: Finally I found a solution. Now the browser can download the .txt files. What I did is, I created a virtual directory in IIS. Here are the steps:
Go to the C: drive
Create a new folder called well-known
Inside the .well-known folder, create another folder named pki-validation
so far, your folders should look like this: C:\.well-known\pki-validation
Upload the TXT file in the pki-validation folder
Open the IIS Manager on your server
Do a right click on your website and select Add Virtual Directory
In the Alias section write .well-known
In the Psychical Path area enter the path to the well known folder. For example: C:\well-known
Press OK to create this alias
The urls are now serving the .txt files. I hope these steps one day saves the other developers time.

Giving access to file from Tomcat to external user

I have Tomcat setup with servlets. When the user request a file to download, then I send him the path to the file to download.
1-Currently the path is in C drive. Do you think I should move it to be somehwere under Tomcat?
2-How can I give the user access to the folder/file so he can download it?
3-Finally, if there are multiple files inside the folder. How can I ensure he can only see this file (i.e. if he manually changes the file name in the URL, he won't get the file with that modifed file name)
Thank you
One possibility:
Yes move them over to tomcat say under /myapp/resources/file_library
when the users requests for a particular file , build a temp user directory and
copy the file in there and send the link to him , as in
/myapp/user_xyz/requestedfile#1
Always maintain the temp location with only one file, i.e. when the user requests another
file, clear the temp user-specific area and put the next file in .
/myapp/user_xyz/requestedfile#2

How to check if file exist at FTP server in Objective-C

In this app, I am using FTP server to download and upload images to the server. Now, I want to check if file exist at server. I would have the file name to check on the server. Currently, I am using FTPManager class to do all uploading and downloading. Its working fine. But I couldn't find any solution to check if file exist at server
Please help me in this.
Assuming you're talking about this FTPManager class, it seems to me like you should be able to create a new FMServer instance with the path to the folder you want, then call the manager's -contentsOfServer: method to get an array of dictionaries containing file information at that path.

Get public url from file path in dropbox

Suppose I have dropbox account, and I have shared folder their, for instance the name of the shared folder is "SampleFolder". And inside that folder I have folder and file hierarchy, which also is shared being inside a shared folder. How can I having SampleFolder url and knowing the file path that I want to download easily get it's url either by Dropbox Core API or just know the way the urls are constructed and construct the url by hand. For instance I want to download file in path SampleFolder/Folder1/Folder2/image.png, how can I get the url of that file knowing only the url of SampleFolder? Let me note that I don't want to login into dropbox, here there is a get method for retrieving file by it's path, but it requires authorisation. Basically I want a public place of storing files, and in my code downloading them by their urls.
Thanks for the answers.
[Addition Aug2017: This method has been disabled by Dropbox for all users. See https://www.dropbox.com/en/help/files-folders/public-folder]
See https://www.dropbox.com/help/16/en towards the bottom under "Creating a Public folder"
While newer accounts do not have the Public Folder enabled, it is possible to enable it by going to this link when logged into that account: https://www.dropbox.com/enable_public_folder
Then you can follow the path to the file after https://dl.dropbox.com/u/<user id>/
This used to be possible with Dropbox, at least in the spring of 2012, but it appears no longer to work. Before, if you had a shared folder, you could browse the subcontents of that folder relative to the shared URL, but now, all the subcontents have distinct absolute URLs.
Breaking basic UNIX file path conventions like this is a huge loss in functionality, in my opinion.
Set your link permission to anyone with a link.
try the following link to access it as public static file:
https://dl.dropboxusercontent.com/s/<docId>/yourfile.ext
docId can be found by clicking on Share button of the doc on the dropbox UI.
This the alphanumeric string found after /s/.
Unfortunately, no, this isn't currently possible in an official or supported way. These shared links don't offer any metadata or API for access like this.
For free users, the Public Folder method for relative paths won't work anymore now. See here.
As of March 15, 2017 the Public folder in your Dropbox account has been converted into a standard folder. By default this folder is private to your account. This transition will occur automatically.

Apache chemistry querying a folder

I am using Apache chemistry to write and read data from a content management system in a Java servlet. I am currently creating a separate folder for each logged on user in the CMS. When the user logs on I have to check and get the reference of the user's Folder so that I can use the same in the session. When the folder is created for the first time, I can get the user's folder using the createFolder call:
Folder userFolder = root.createFolder(newFolderProps);
However if the folder already exists, the only way I can get the folder is by Iterating throught all the children. This can be pretty inefficient. I was wondering if there is any way of specifying the folder name as a query parameter so that I can directly get the users folder without iterating over all the child folders.
Try getObject() or getObjectByPath():
Folder userFolder = (Folder) session.getObject(folderId);
Folder userFolder = (Folder) session.getObjectByPath(folderPath);