Paperclip plugin : Change image folder permissions - ruby-on-rails

By default when I upload new images, the folder created have 777
permissions
Is there a way to restrict permissions on the new folders?
Thanks

Other way you can do this by changing in the paperclip plugin itself.
Change the permission as you want in the below file of paperclip plugin
/lib/paperclip/storage.rb

Related

Prepros 6 SFTP directory uploaded to wrong path

I have a directory upload issue in Prepros 6.1.1, with SFTP only.
This may be related to that question: Folders uploading in Prepros
The file upload is OK, but Prepros will create directories in the wrong path!
Example
I want to upload new-directory/new-file to /home/myuser/www/:
If new-directory exists on the server ; no problem, the file is uploaded in there.
If I upload a new file in a new directory ;
Prepros will create the directory in /home/myuser/home/myuser/www/new-directory,
then try to upload the file to /home/myuser/www/new-directory which doesn't exists…
Does anyone have found a workaround?
How is your FTP config?
Open FTP Settings and on Remote Path yout insert all the path to the directory you want. For example:
I want to upload a file to my test folder, then, on the remote path field, i will insert
/public_html/test/
This way all the files will be uploaded to this directory

How to ignore uploads folder to stop content being removed on docker server when new build is created

I have created one uploads folder on the server and I am uploading an image in this folder using the upload functionality of PHP.
Now whenever a new build is created my newly created folder and uploaded files are removed which are inside this folder, as docker looks the repo for creating new image and not considering newly uploaded folder and files.
So, can anyone let me know what is the technique for "uploading image" functionality using PHP on docker.
Should I create a dockerignore file for informing docker to not to touch my "uploads" folder ? Will this work?
I doubt that dockeringore file will surely ignore "uploads" folder but the new image may not have my newly created folder and files inside the "uploads" folder as "uploads" folder is present in repo but my newly created folder and files are not present in repo so while creating new image docker may pick the "uploads" folder from repo and will ignore it also but will not include the newly created folder and files inside this folder. But this is my assumption.
Any help would be appreciated.
Well it is difficult to understand in which moment you are modifying your upload folder content. I will assume that this happens when your container is running and when you build again the container you lose its content.
Use volumes for that :
docker volume create --name data
docker run -v data:upload_folder_path_in-container
Hope it helps

Refinerycms: file names lost after migrating files from one AWS S3 bucket to another

This is how I encountered the problem:
Uploaded files to S3
Tried to download the file, it works ok
Migrated the files in that bucket to another bucket (under the same AWS account)
Tried to download the file again, it works, the file is downloaded, but the name of the file is just "file", no extension.
If I change the file name to add the extension, it still opens. So the content of the file is ok, but the file name is lost after migrating to another bucket.
Has anybody met this problem before? Or know any potential causes of this?
Thanks
I figured this out.
It is because the metadata was lost during the migration.
I was moving files from one bucket to another by downloading them to local machine first.
What I should have done is :
aws s3 cp s3://b1 s3://b2 --recursive

Cordova Write To WWW Directory (iOS)

I am trying to write a file to a directory within the WWW directory of my Cordova app.
Here is the situation:
My program saves an image to the temporary directory
I want the program to move the image from the temporary directory to the WWW directory, so that the file does not get deleted every time the app is initialized.
Is this possible?
Thanks.
No that's not possible. The WWW is sandboxed and therefore, you can't write anything inside of this folder. If you want to save a file you need to use the DOCUMENTS path and rely on the Cordova file plugin (PERSISTENT is the keyword)
https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md
You can also check the folder permissions here:
https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md#ios-file-system-layout
As you can see, www is read-only (not r/w)

Copying files from a Rails plugin into the application upon plugin install

When someone installs this plugin, I would like a file to be copied into the config/initializers directory of the app. I could do this in install.rb by copying a template file that resides somewhere in the plugin. Another option would be to require the user to run a generator after install. I know rspec-rails makes you run a generator after you install it, is that the recommended behavior?
And is there anything wrong with copying files into the application in install.rb?
Thanks!
Lou
Does the user need to manually tweak the file? If so, then I would use a generator with parameters. If not, I would prefer that you do it with install.rb. My $.02

Resources