I want to save my uploads in a specific folder for each app_id. For example, when an applicant with app_id of 45 uploads the files it must save in a folder named 45 whilst all his/her uploads such as birth certificate, college certificate, profile picture and high school certificate will be in that folder, same to the other app_id eg 89 must have his/her own folder but all the uploaded files will be located in one parent folder for example webroot/files/uploads/....
I managed to implement Uploader v3.6 from Miles Johnson, so any help on that plugin or any other solutions
Any tutorial or link to tackle this challenge
Thank you
A huge security fail in your idea is to store high school certificates in the public (!) accessible /webroot/files/uploads folder. You can be sure to get in pretty unpleasant situations in many countries that have privacy laws if everyone can download these proivate documents from your server.
Storing the files in folders 1, 2, 3... using the incremental ids is also a bad idea performance wise: Read the section "File System Performance" of this article.
Storing all files attached to a user in the same folder might be a good idea if you want to delete all of them in one action when you delete the user but you should not forget about sanitizing the file names properly. But again: If you store thousands of files in the same (sub) folder you might get into issues again.
For a file storage solution for CakePHP 2.x I can suggest you to read the readme.md of my FileStorage plugin that covers nearly all common problems and gives you a solid base for a file storage.
Related
I am dealing with one problem, before starting developing, I decided to do some research.
So the problem is what would be the efficient solution when storing files?
I read about it, and some people was against storing files within database, as it will have negative impact on backups / restorations, it will add more processing time when reading database for large files and etc...
Good option would be to use S3 or any other cloud solution to store the files, but for this current customer cloud won't be good.
Another option would be to store files under file system. The concept is clear, but I try to understand what I need to understand before implementing that solution.
For example we need to consider how we structure directories, if we would store 100 000 files in one directory it can be come slow to open and etc. As well there is like maximum amount of files that can be stored in one directory.
Is there any 3rd party tools that helps to manage files in file system? that automatically partitions files and places them in directories?
I work with a software that have more than 10 million files in file system, how you will structure the folders depends, but what I did was:
Create a folder to each entity (Document, Image...)
Into each folder create a folder to each ID object with ID beign the name of the folder, and put their files inside, but this could vary.
Example to Person that have the ID 15:
ls /storage/Person/15/Image/
Will give me this 4 images that in the database I linked to person with the ID 15:
Output:
1.jpg
2.png
3.bmp
4.bmp
If you have a HUGE amount of elements, you cold separate each digit of an ID into a subfolder, that is: Person wih ID 16549 will have this path: /storage/Person/1/6/5/4/9/Image/
About limits of files in folder I suggest you to read this thread: https://stackoverflow.com/a/466596/12914069
About a 3rd party tool I don't know, but for sure you could build this logic into your code.
English isn't my first language, tell me if you didn't understand something.
I have somehow turned into the person to oversee my organization's SharePoint and I have been tasked with finding a way that when a file is uploaded to any of our document libraries the file name of said file is either prepended, appended with a date or random string in an effort to prevent naming collisions.
I understand that SharePoint will block uploading files with the same name but I would like to just apprend or prepend a date or string to the file name to just bypass the whole issue. Our users aren't the most tech savvy so to automatically rename their files for them would help us and them both.
Is there a way to do this currently in SharePoint's settings? I've looked into versioning and Document ID but neither prevent the naming issues so far. Is there a plug-in of some sort I could use? or do I need to have code written by someone and have it added to SharePoint?
Thanks!
The Content Organizer feature of SharePoint 2010 allows you to set a duplicate submissions tag to documents.
"Duplicate Submissions
This option specifies whether to use SharePoint versioning or append unique characters to the end of duplicate file names if a document is uploaded that has the same name as a document that is already in the destination library."
Play around with this to see if it is going to help before worrying about a more complex coded solution. Your users may also appreciate the drop box approach to document uploading.
Lets say I let people upload files on the server. Should I change the file name s
after the upload ? if yes, how can I tell the about the file names later on , beacause in CMS I need tpo provide them with the url to images or doc files etc so they refer to them while producing text for the website.
I coded a program with which my users can navigate through some files and folders
they can create folders and upload files of any extension inside the mentioned folders
. Unfortinately my code creates all files and foldes with 777 permission. I wanna know
What would happen if someone uploads a .php file inside a folder and runs it. Can he/she
Delete every possible thing ? May you help me with right permission I should give to those files
and folders. The uploader should know about the url where he/she has uploaded
the image so while creating some content he can refer to them as url for images or
office word documents. Please help me with security hole.
Thank you.
I suggest you create some database table as a reference to those file so that you can record the old name, and changing the name in file system to different one so that you will never overwrite an existing file with same name.Or you can even same file in DB instead of file system.
First thing is you should not allow user upload any executable files to your server, or at least you need to change the extension name to something else I think. And I don't think 777 is needed, you just need to make sure the folder r/w to the php/web server processor and that's should be enough for any user access them
I am interested in creating a video databse. My goal is to have a folder where my videos will be kept and each time I copy/delete a video the website that presents them should be updated to. the problem is I have no idea how to approach it.
Should I..
Use Sql and store a reference to each video location?
Have a script that checks all the time if new changes happen in that folder?
A package like joomla?
I am using ubuntu btw. I already have a simple html5 page, and I am presenting the videos using html5 video.
It depends on the size and the performance you want.
1.Way : use php to scan the folder and generate links on the fly
2.way : Use a database to store the file names and retrieve the names from the database and generate urls
pros and cons.
simple to implement , no changes in upload or download script. no database required.
You need have a database , little coding required for upload and also while genrating a page
You should make a db (format does not matter) and storing in it only file names of videos: the videos would be stored on hard drive.
Any operation on the web site will pass first on db for insert/update/delete videos records and then (maybe in a transaction context) on the file system.
This would be the standard approach to your question.
What is the best method to follow for uploading files to server using my website? Each user will upload some files to his profile. Should I place all files in a single directory or do I need to create folders for each user and keep the files there?
How does YouTube do this? How should I store the uploaded info in database? What's the most efficient approach to do this when handling large number of users and files? I don't want to know about the usage of API. I want to know the best approach for file organization.
I would have a folder for each user, its more managable!
I wouldn't fancy a massive folder with loads of files!
You could end up with duplicate file names and end up deleting another users files!
I would create a directory for every user!