How to validate file to be uploaded? - jsf

I am working on liferay project. I have to put file upload functionality. For which I have used
<bridge:inputFile/>
But my upload method is not called when I try to upload a blank file of 0 bytes. Actually my validation for blank file is inside my upload method.

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

Can't create .zip file with Azure Logic Apps' SharePoint Create File action

I'm trying to create a .zip file by passing the returned body of an HTTP GET request to SharePoint's Create File.
Body is:
{
"$content-type": "application/zip",
"$content": "UEsDBBQACA...="
}
Shouldn't this just work? The docs only define the Create File field as "Content of the file." but that's not super informative...
I believe I've done this before with a file that was application/pdf and it worked. Unfortunately, I can't find that Logic App (I think it may have been an experiment I've since deleted).
I should note that the Create File action does create a valid .zip file, in that it's not corrupt, but archive is empty. It's supposed to contain a single .csv file.
I tried decoding the Base64 content and it's definitely binary data.
Any idea where I'm going wrong?
I test with Postman and when I use the form-data way to POST the request, I found the .zip file couldn't be open. Then I check the Logic App run history and I find the problem is if just use the triggerbody() as the file content it will fail.
This is because the triggerbody() not just have the $content, so I change the expression to triggerBody()['$multipart'][0]['body'] then it works and the .zip file is full.

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?

Can Gitlab API upload file to repo?

https://docs.gitlab.com/ee/api/projects.html#upload-a-file
After upload image, I got the url, but didn't added to my repo files?
Can we upload image to repo files?
The /projects/:id/uploads doesn't add anything to your project's repository. The description says:
Uploads a file to the specified project to be used in an issue or merge request description, or a comment.
To upload a file to the actual repo you need to use the /projects/:id/repository/files/:file_path endpoint.
To upload an image specifically, you'll need to:
Set the encoding parameter to base64
Convert your image to base64
Remove the data:image/png;base64, part at the beginning
Set the content parameter to the remaining part of the base64

CodeIgniter - Directory Traversal - sanitize_filename()

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

Resources