CodeIgniter - Directory Traversal - sanitize_filename() - security

If I use the CodeIgniter File Upload Class and rename the image being uploaded using:
$config['file_name']
do I still have to use
$this->security->sanitize_filename()
on the image being uploaded by user?

just set $config['encrypt_name']; will automatically rename users uploaded file or image for more information check user guide of File uploading library
File Upload Library

Related

Don't overwrite existing file nodejs express-fileupload

I tried out the express-fileupload sample project, to test uploading files. However, if I upload a file with a name that is already uploaded e.g. test.jpg (uploaded) test.jpg (to be uploaded) it just overwrites the old file. Is there an easy way to prevent this or do I have to code something that checks if that file already exists.
Sample Project: https://github.com/richardgirges/express-fileupload/tree/master/example

Is there any way I can display pdfs uploaded in my files using nodejs and ejs?

I created a way to upload files using Multer in my files then display their information to my frontend. My challenge is opening the uploaded PDF as when I click the link to open it says that it cannot get.
You need to specify your static files in Express.
Use app.use(express.static('public')) to specify that your static files are located on public folder.
And for get a file you don't need to add public in the url, for example:
http://localhost:3000/pdf/mypdf.pdf
See this documentation

Sharepoint nodejs upload file

I'm trying to upload a file to the SharePoint shared folder.
I am able to upload a file using spsave but its uploading to the Files location. I would like to upload to the Shared location instead of Files location. Doing it in this way:
const fileOptions = {
folder: '/Documents/testing',
fileName: 'test.txt',
fileContent: 'hello world'
};
it's uploading to the Files location under testing folder I can see the file text.txt. Can't figure it out how to upload to the Shared folder. Is this possible? Can't find the related path for the shared destination. For Files it's Documents but what would be for the Shared??? Anyone have any knowledge about sharepoint onedrive and could help me with this?
I don't think you can upload to OneDrive with spsave. It is for native SharePoint only afaik. If you want to share a file in OneDrive using a rest api I suggest to look at office graph.

Uploading zip file to sharepoint using REST is not saving the file contents

Uploading zip file to sharepoint using REST is not saving the file contents. The operation is sucessful. But when the file is downloaded from site to local machine, its failing to open the zip and showing 0 bytes
Did you follow:
https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery
Creating the item (with the meta data) in the library and upload the file (binary) are two seperate actions you have to handle to complete the upload. I think you only add an item to the library and not uploading the binary data?

Is it possible to upload a server file to cloud using multer?

I want to upload a file which is being generated on my server conditionally in a directory, and I am using multer-s3 package to upload files to S3 service.
Is it possible to upload that generated file from server directory to S3 using multer-s3?
No, it is not possible to upload the generated file to s3 using multer-s3, because multer-s3 library has been designed and written in a way to provide alternative storage engine to multer, not as a library to upload file to s3. You can use some other library to upload files to s3 or you can read it here https://github.com/badunk/multer-s3/blob/master/index.js#L172

Resources