How to check if file with same name has been attached in PowerApps? - attachment

I want user to add files with different names. Currently default PowerApps control allows attachment of files with same names. But, while saving the form it saves only 1 file. I want to restrict users from attaching files with same name.

Make a new collection to store the name of the files user is uploading through attachment control using "onAttach" method.
When user tries to attach the file with same name check the collection if the file name exist's. Display a error/warning message Or Disable the save/submit button for that form.

Related

How to save multiple files at once through delphi save dialog

I'm not able to save multiple files at a time in delphi save dialog box. Multiple files means I want save files without mentioning anything(or only asterisk) at "filename" field in delphi TsaveDialog. Please let me know how to achieve that.
Of course not, because that is not what it is intended for. You CANNOT obtain multiple filenames from a single save dialog. It only provides one filename at a time. That is by design.
I suspect what you really want is to prompt the user for just a folder path instead. Use the SelectDirectory() function (or the Win32 SHBrowseForFolder() function directly) for that, then you can create whatever files you need in that folder.
The save dialog doesn't save files. It allows the user to select file names. The save dialog doesn't support multiple selection so if you want to have a file dialog that allows multiple selections you need an open dialog. But an open dialog typically is used to select names of existing files, whereas a save dialog can specify a name of a file that does not yet exist.
Wildcards when entered into file dialogs are used to filter the displayed list of files. The file dialog won't return file names containing wildcards.
You imagine using wildcards, but how would you be able to do that and create new files? Wildcards are used to pattern match against existing files.
Maybe what you need is a folder selection dialog. Or perhaps you should ask the user for the name of the "master" file and then you generate the names of the "auxiliary" files using the master file name as a stem. I'm guessing because you've not told us any specifics behind your question.
My advice is to reconsider carefully what you are attempting to achieve. Think of all possible corner cases. Explore what UI idioms are used by other programs. Make sure you understand fully the capability of the file dialog controls. And then design your UI to fit with all of these constraints.

Kendo UI upload control remove firing after save when multiple set to false

I am using the Kendo Upload control and need to allow the user to only upload one file at a time. I set the multiple option to false on the client side and this works. However, if a user uploads a file and then immediately tried to upload a second file, the removeUrl is called first which gets passed a string array of file names. Here is the problem, when I save a file I am renaming the file to a name using guid values and creating a database table entry to associate the file with the user. I need a way to reset the filename to the guid after the file is uploaded and its name is displayed? Is there a way to do this?
Try utilizing the Files configuration option. With that, you should be able to reset the displayed file names to any name you choose.

Uploading multiples files to alternative directory with alternative name in FuelPHP

I have a form having multiple upload fields. Let's assume a thumbnail image and the large image. Now using the FuelPHP how can i save this two files to two different locations renaming them to name desired.
For example:
I want to save the thumbnail to media/images/thumbnail/db_record_id/thumbnail.extension and the large image to media/images/large/db_record_id/thumbnail.extension
using the answer to this question Multiple uploads to different directories using FuelPHP, I can upload to the desired directories but how to give the desired name?
If you want full control, register a 'before' callback.
If will be called before saving the file, with the File object of that file. It's passed by reference, so you can alter whatever you want.

How to access uploaded files from views

All the uploaded files are stored under
__namespace__/src/__namespace/Controller/logos/file.jpg
and controller file returns only file name "file.jpg" in the view.
So how can I provide path to logo folder in my view in IMG tag
This is where you made the first "Error"! Never store user-data inside your Modules!
When you have users upload data for your module, store them under /data/module-name/! That way you can easily access the files via src="../data/module-name/filename.jpg"
Alternatively, when you want to provide files with your Module and be able to use them, theres a great Module out there called AssetManager, which in turn uses Assetic.

Prepopulate file upload form in struts 2

I am working on a struts 2 web application where user can upload file through a file upload form, if the file already exists in database, a confirmation message should be displayed to overwrite the existing file or cancel the action.
On upload the database is queried for that file and if it exists the action results and set a flag in session which shows the jquery dialog box for user confirmation. I need to implement continue button in the dialog box which will set another flag to specify overwrite and call the same action again, this time the file will be uploaded. To implement this I need to prefill the file upload input box with previous request parameter before calling the upload action.
Is there any other method to implement the above requirement?
Please let me know in case any details are required.
Thanks in advance.
I assume that you dont want to upload a file if a file with same filename exists in the database. If this is the case, why dont you check for the duplicity of filenames as soon as a file is selected to upload. This can be done in two ways
load list of all the filenames along with the page and check the selected filename with this list
Use ajax to send request to server for checking for duplicate filename when a file is selected
You can use the onchange event of the file element
For security reasons, you cannot mess with the value attribute of the file element programatically, otherwise you could fill-in any file from the user's system and submit the form
You can get user confirmation before sending the request by a checkbox asking whether to overwrite if the file exists. Then in your action do your IO stuff.
But if you still want to show the confirmation after sending the request I suggest you to use a custom interceptor that passes the request on both conditions of user confirmation and existence of the file. If the check didn't pass, you can return a custom result for confirmation part and resubmit the request. Just an idea.

Resources